2014-02-18 04:30:05 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H
|
|
|
|
#define MOZILLA_GFX_X11TEXTURESOURCEOGL__H
|
|
|
|
|
|
|
|
#ifdef GL_PROVIDER_GLX
|
|
|
|
|
2014-10-16 17:48:29 +04:00
|
|
|
#include "mozilla/layers/CompositorOGL.h"
|
2014-02-18 04:30:05 +04:00
|
|
|
#include "mozilla/layers/TextureHostOGL.h"
|
2015-08-27 06:41:07 +03:00
|
|
|
#include "mozilla/layers/X11TextureHost.h"
|
2014-02-18 04:30:05 +04:00
|
|
|
#include "mozilla/gfx/2D.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
// TextureSource for Xlib-backed surfaces.
|
|
|
|
class X11TextureSourceOGL
|
2014-04-11 18:15:01 +04:00
|
|
|
: public TextureSourceOGL
|
2015-08-27 06:41:07 +03:00
|
|
|
, public X11TextureSource
|
2014-02-18 04:30:05 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface);
|
2014-02-22 13:22:43 +04:00
|
|
|
~X11TextureSourceOGL();
|
2014-02-18 04:30:05 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual X11TextureSourceOGL* AsSourceOGL() override { return this; }
|
2014-02-18 04:30:05 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsValid() const override { return !!gl(); } ;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) override;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetTextureTarget() const override { return LOCAL_GL_TEXTURE_2D; }
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; }
|
2014-02-18 04:30:05 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DeallocateDeviceData() override;
|
2014-02-18 04:30:05 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetCompositor(Compositor* aCompositor) override;
|
2014-02-18 04:30:05 +04:00
|
|
|
|
2015-08-27 06:41:07 +03:00
|
|
|
virtual void Updated() override { mUpdated = true; }
|
|
|
|
|
2014-02-18 04:30:05 +04:00
|
|
|
gl::GLContext* gl() const;
|
2014-04-11 18:15:01 +04:00
|
|
|
|
2014-02-18 04:30:05 +04:00
|
|
|
static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
|
|
|
|
|
|
|
|
protected:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CompositorOGL> mCompositor;
|
|
|
|
RefPtr<gfxXlibSurface> mSurface;
|
|
|
|
RefPtr<gfx::SourceSurface> mSourceSurface;
|
2014-02-22 13:22:43 +04:00
|
|
|
GLuint mTexture;
|
2015-08-27 06:41:07 +03:00
|
|
|
bool mUpdated;
|
2014-02-18 04:30:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2014-02-22 13:22:43 +04:00
|
|
|
#endif // MOZILLA_GFX_X11TEXTURESOURCEOGL__H
|