/src/mozilla-central/gfx/gl/MozFramebuffer.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */ |
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 MOZ_FRAMEBUFFER_H_ |
7 | | #define MOZ_FRAMEBUFFER_H_ |
8 | | |
9 | | #include "gfx2DGlue.h" |
10 | | #include "GLConsts.h" |
11 | | #include "GLContextTypes.h" |
12 | | #include "mozilla/UniquePtr.h" |
13 | | #include "mozilla/WeakPtr.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace gl { |
17 | | |
18 | | class MozFramebuffer final |
19 | | { |
20 | | const WeakPtr<GLContext> mWeakGL; |
21 | | public: |
22 | | const gfx::IntSize mSize; |
23 | | const uint32_t mSamples; |
24 | | const GLuint mFB; |
25 | | const GLenum mColorTarget; |
26 | | private: |
27 | | const GLuint mColorName; |
28 | | const GLuint mDepthRB; |
29 | | const GLuint mStencilRB; |
30 | | |
31 | | public: |
32 | | static UniquePtr<MozFramebuffer> Create(GLContext* gl, const gfx::IntSize& size, |
33 | | uint32_t samples, bool depthStencil); |
34 | | |
35 | | static UniquePtr<MozFramebuffer> CreateWith(GLContext* gl, const gfx::IntSize& size, |
36 | | uint32_t samples, bool depthStencil, |
37 | | GLenum colorTarget, GLuint colorName); |
38 | | private: |
39 | | MozFramebuffer(GLContext* gl, const gfx::IntSize& size, uint32_t samples, |
40 | | bool depthStencil, GLenum colorTarget, GLuint colorName); |
41 | | public: |
42 | | ~MozFramebuffer(); |
43 | | |
44 | 0 | GLuint ColorTex() const { |
45 | 0 | if (mColorTarget == LOCAL_GL_RENDERBUFFER) |
46 | 0 | return 0; |
47 | 0 | return mColorName; |
48 | 0 | } |
49 | | }; |
50 | | |
51 | | } // namespace gl |
52 | | } // namespace mozilla |
53 | | |
54 | | #endif // MOZ_FRAMEBUFFER_H_ |