/src/mozilla-central/gfx/layers/GLImages.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 GFX_GLIMAGES_H |
8 | | #define GFX_GLIMAGES_H |
9 | | |
10 | | #include "AndroidSurfaceTexture.h" |
11 | | #include "GLContextTypes.h" |
12 | | #include "GLTypes.h" |
13 | | #include "ImageContainer.h" // for Image |
14 | | #include "ImageTypes.h" // for ImageFormat::SHARED_GLTEXTURE |
15 | | #include "nsCOMPtr.h" // for already_AddRefed |
16 | | #include "mozilla/gfx/Point.h" // for IntSize |
17 | | |
18 | | namespace mozilla { |
19 | | namespace layers { |
20 | | |
21 | | class GLImage : public Image |
22 | | { |
23 | | public: |
24 | 0 | explicit GLImage(ImageFormat aFormat) : Image(nullptr, aFormat){} |
25 | | |
26 | | already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override; |
27 | | |
28 | 0 | GLImage* AsGLImage() override { return this; } |
29 | | }; |
30 | | |
31 | | #ifdef MOZ_WIDGET_ANDROID |
32 | | |
33 | | class SurfaceTextureImage : public GLImage |
34 | | { |
35 | | public: |
36 | | SurfaceTextureImage(AndroidSurfaceTextureHandle aHandle, |
37 | | const gfx::IntSize& aSize, |
38 | | bool aContinuous, |
39 | | gl::OriginPos aOriginPos); |
40 | | |
41 | | gfx::IntSize GetSize() const override { return mSize; } |
42 | | AndroidSurfaceTextureHandle GetHandle() const { return mHandle; } |
43 | | bool GetContinuous() const { return mContinuous; } |
44 | | gl::OriginPos GetOriginPos() const { return mOriginPos; } |
45 | | |
46 | | already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override |
47 | | { |
48 | | // We can implement this, but currently don't want to because it will cause |
49 | | // the SurfaceTexture to be permanently bound to the snapshot readback |
50 | | // context. |
51 | | return nullptr; |
52 | | } |
53 | | |
54 | | SurfaceTextureImage* AsSurfaceTextureImage() override { return this; } |
55 | | |
56 | | private: |
57 | | AndroidSurfaceTextureHandle mHandle; |
58 | | gfx::IntSize mSize; |
59 | | bool mContinuous; |
60 | | gl::OriginPos mOriginPos; |
61 | | }; |
62 | | |
63 | | #endif // MOZ_WIDGET_ANDROID |
64 | | |
65 | | } // namespace layers |
66 | | } // namespace mozilla |
67 | | |
68 | | #endif // GFX_GLIMAGES_H |