michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H michael@0: #define MOZILLA_GFX_X11TEXTURESOURCEOGL__H michael@0: michael@0: #ifdef GL_PROVIDER_GLX michael@0: michael@0: #include "mozilla/layers/TextureHostOGL.h" michael@0: #include "mozilla/gfx/2D.h" michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: // TextureSource for Xlib-backed surfaces. michael@0: class X11TextureSourceOGL michael@0: : public TextureSourceOGL michael@0: , public NewTextureSource michael@0: { michael@0: public: michael@0: X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface); michael@0: ~X11TextureSourceOGL(); michael@0: michael@0: virtual X11TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; } michael@0: michael@0: virtual bool IsValid() const MOZ_OVERRIDE { return !!gl(); } ; michael@0: michael@0: virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE; michael@0: michael@0: virtual gfx::IntSize GetSize() const MOZ_OVERRIDE; michael@0: michael@0: virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return LOCAL_GL_TEXTURE_2D; } michael@0: michael@0: virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE; michael@0: michael@0: virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; } michael@0: michael@0: virtual void DeallocateDeviceData() MOZ_OVERRIDE; michael@0: michael@0: virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE; michael@0: michael@0: gl::GLContext* gl() const; michael@0: michael@0: static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType); michael@0: michael@0: protected: michael@0: CompositorOGL* mCompositor; michael@0: nsRefPtr mSurface; michael@0: RefPtr mSourceSurface; michael@0: GLuint mTexture; michael@0: }; michael@0: michael@0: } // namespace layers michael@0: } // namespace mozilla michael@0: michael@0: #endif michael@0: michael@0: #endif // MOZILLA_GFX_X11TEXTURESOURCEOGL__H