gfx/layers/opengl/X11TextureSourceOGL.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:6f35090b65d8
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/. */
5
6 #ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H
7 #define MOZILLA_GFX_X11TEXTURESOURCEOGL__H
8
9 #ifdef GL_PROVIDER_GLX
10
11 #include "mozilla/layers/TextureHostOGL.h"
12 #include "mozilla/gfx/2D.h"
13
14 namespace mozilla {
15 namespace layers {
16
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();
25
26 virtual X11TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
27
28 virtual bool IsValid() const MOZ_OVERRIDE { return !!gl(); } ;
29
30 virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE;
31
32 virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
33
34 virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return LOCAL_GL_TEXTURE_2D; }
35
36 virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
37
38 virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
39
40 virtual void DeallocateDeviceData() MOZ_OVERRIDE;
41
42 virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
43
44 gl::GLContext* gl() const;
45
46 static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
47
48 protected:
49 CompositorOGL* mCompositor;
50 nsRefPtr<gfxXlibSurface> mSurface;
51 RefPtr<gfx::SourceSurface> mSourceSurface;
52 GLuint mTexture;
53 };
54
55 } // namespace layers
56 } // namespace mozilla
57
58 #endif
59
60 #endif // MOZILLA_GFX_X11TEXTURESOURCEOGL__H

mercurial