Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H
7 #define MOZILLA_GFX_X11TEXTURESOURCEOGL__H
9 #ifdef GL_PROVIDER_GLX
11 #include "mozilla/layers/TextureHostOGL.h"
12 #include "mozilla/gfx/2D.h"
14 namespace mozilla {
15 namespace layers {
17 // TextureSource for Xlib-backed surfaces.
18 class X11TextureSourceOGL
19 : public TextureSourceOGL
20 , public NewTextureSource
21 {
22 public:
23 X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface);
24 ~X11TextureSourceOGL();
26 virtual X11TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
28 virtual bool IsValid() const MOZ_OVERRIDE { return !!gl(); } ;
30 virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE;
32 virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
34 virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return LOCAL_GL_TEXTURE_2D; }
36 virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
38 virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
40 virtual void DeallocateDeviceData() MOZ_OVERRIDE;
42 virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
44 gl::GLContext* gl() const;
46 static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
48 protected:
49 CompositorOGL* mCompositor;
50 nsRefPtr<gfxXlibSurface> mSurface;
51 RefPtr<gfx::SourceSurface> mSourceSurface;
52 GLuint mTexture;
53 };
55 } // namespace layers
56 } // namespace mozilla
58 #endif
60 #endif // MOZILLA_GFX_X11TEXTURESOURCEOGL__H