/src/mozilla-central/gfx/layers/opengl/X11TextureSourceOGL.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H |
8 | | #define MOZILLA_GFX_X11TEXTURESOURCEOGL__H |
9 | | |
10 | | #ifdef MOZ_X11 |
11 | | |
12 | | #include "mozilla/layers/CompositorOGL.h" |
13 | | #include "mozilla/layers/TextureHostOGL.h" |
14 | | #include "mozilla/layers/X11TextureHost.h" |
15 | | #include "mozilla/gfx/2D.h" |
16 | | |
17 | | namespace mozilla { |
18 | | namespace layers { |
19 | | |
20 | | // TextureSource for Xlib-backed surfaces. |
21 | | class X11TextureSourceOGL |
22 | | : public TextureSourceOGL |
23 | | , public X11TextureSource |
24 | | { |
25 | | public: |
26 | | X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface); |
27 | | ~X11TextureSourceOGL(); |
28 | | |
29 | 0 | virtual X11TextureSourceOGL* AsSourceOGL() override { return this; } |
30 | | |
31 | 0 | virtual bool IsValid() const override { return !!gl(); } ; |
32 | | |
33 | | virtual void BindTexture(GLenum aTextureUnit, gfx::SamplingFilter aSamplingFilter) override; |
34 | | |
35 | | virtual gfx::IntSize GetSize() const override; |
36 | | |
37 | 0 | virtual GLenum GetTextureTarget() const override { return LOCAL_GL_TEXTURE_2D; } |
38 | | |
39 | | virtual gfx::SurfaceFormat GetFormat() const override; |
40 | | |
41 | 0 | virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; } |
42 | | |
43 | | virtual void DeallocateDeviceData() override; |
44 | | |
45 | | virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; |
46 | | |
47 | 0 | virtual void Updated() override { mUpdated = true; } |
48 | | |
49 | 0 | gl::GLContext* gl() const { |
50 | 0 | return mGL; |
51 | 0 | } |
52 | | |
53 | | static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType); |
54 | | |
55 | | protected: |
56 | | RefPtr<gl::GLContext> mGL; |
57 | | RefPtr<gfxXlibSurface> mSurface; |
58 | | RefPtr<gfx::SourceSurface> mSourceSurface; |
59 | | GLuint mTexture; |
60 | | bool mUpdated; |
61 | | }; |
62 | | |
63 | | } // namespace layers |
64 | | } // namespace mozilla |
65 | | |
66 | | #endif |
67 | | |
68 | | #endif // MOZILLA_GFX_X11TEXTURESOURCEOGL__H |