OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrRenderTarget_DEFINED | 8 #ifndef GrRenderTarget_DEFINED |
9 #define GrRenderTarget_DEFINED | 9 #define GrRenderTarget_DEFINED |
10 | 10 |
11 #include "GrSurface.h" | 11 #include "GrSurface.h" |
12 #include "SkRect.h" | 12 #include "SkRect.h" |
13 | 13 |
14 class GrStencilBuffer; | 14 class GrStencilBuffer; |
15 | 15 |
16 /** | 16 /** |
17 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. | 17 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. |
18 * A context's render target is set by setRenderTarget(). Render targets are | 18 * A context's render target is set by setRenderTarget(). Render targets are |
19 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. | 19 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. |
20 * Additionally, GrContext provides methods for creating GrRenderTargets | 20 * Additionally, GrContext provides methods for creating GrRenderTargets |
21 * that wrap externally created render targets. | 21 * that wrap externally created render targets. |
22 */ | 22 */ |
23 class GrRenderTarget : virtual public GrSurface { | 23 class GrRenderTarget : virtual public GrSurface { |
24 public: | 24 public: |
25 SK_DECLARE_INST_COUNT(GrRenderTarget) | 25 SK_DECLARE_INST_COUNT(GrRenderTarget) |
26 | 26 |
27 // GrSurface overrides | 27 // GrSurface overrides |
28 virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE { return this; } | 28 GrRenderTarget* asRenderTarget() SK_OVERRIDE { return this; } |
29 virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return t
his; } | 29 const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return this; } |
30 | 30 |
31 // GrRenderTarget | 31 // GrRenderTarget |
32 /** | 32 /** |
33 * If this RT is multisampled, this is the multisample buffer | 33 * If this RT is multisampled, this is the multisample buffer |
34 * @return the 3D API's handle to this object (e.g. FBO ID in OpenGL) | 34 * @return the 3D API's handle to this object (e.g. FBO ID in OpenGL) |
35 */ | 35 */ |
36 virtual GrBackendObject getRenderTargetHandle() const = 0; | 36 virtual GrBackendObject getRenderTargetHandle() const = 0; |
37 | 37 |
38 /** | 38 /** |
39 * If this RT is multisampled, this is the buffer it is resolved to. | 39 * If this RT is multisampled, this is the buffer it is resolved to. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 protected: | 111 protected: |
112 GrRenderTarget(GrGpu* gpu, | 112 GrRenderTarget(GrGpu* gpu, |
113 bool isWrapped, | 113 bool isWrapped, |
114 const GrSurfaceDesc& desc) | 114 const GrSurfaceDesc& desc) |
115 : INHERITED(gpu, isWrapped, desc) | 115 : INHERITED(gpu, isWrapped, desc) |
116 , fStencilBuffer(NULL) { | 116 , fStencilBuffer(NULL) { |
117 fResolveRect.setLargestInverted(); | 117 fResolveRect.setLargestInverted(); |
118 } | 118 } |
119 | 119 |
120 // override of GrResource | 120 // override of GrResource |
121 virtual void onAbandon() SK_OVERRIDE; | 121 void onAbandon() SK_OVERRIDE; |
122 virtual void onRelease() SK_OVERRIDE; | 122 void onRelease() SK_OVERRIDE; |
123 | 123 |
124 private: | 124 private: |
125 GrStencilBuffer* fStencilBuffer; | 125 GrStencilBuffer* fStencilBuffer; |
126 | 126 |
127 SkIRect fResolveRect; | 127 SkIRect fResolveRect; |
128 | 128 |
129 typedef GrSurface INHERITED; | 129 typedef GrSurface INHERITED; |
130 }; | 130 }; |
131 | 131 |
132 #endif | 132 #endif |
OLD | NEW |