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 "GrRect.h" | |
12 #include "GrSurface.h" | 11 #include "GrSurface.h" |
| 12 #include "SkRect.h" |
13 | 13 |
14 class GrStencilBuffer; | 14 class GrStencilBuffer; |
15 class GrTexture; | 15 class GrTexture; |
16 | 16 |
17 /** | 17 /** |
18 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. | 18 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. |
19 * A context's render target is set by setRenderTarget(). Render targets are | 19 * A context's render target is set by setRenderTarget(). Render targets are |
20 * created by a createTexture with the kRenderTarget_TextureFlag flag. | 20 * created by a createTexture with the kRenderTarget_TextureFlag flag. |
21 * Additionally, GrContext provides methods for creating GrRenderTargets | 21 * Additionally, GrContext provides methods for creating GrRenderTargets |
22 * that wrap externally created render targets. | 22 * that wrap externally created render targets. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 /** | 83 /** |
84 * Call to indicate the multisample contents were modified such that the | 84 * Call to indicate the multisample contents were modified such that the |
85 * render target needs to be resolved before it can be used as texture. Gr | 85 * render target needs to be resolved before it can be used as texture. Gr |
86 * tracks this for its own drawing and thus this only needs to be called | 86 * tracks this for its own drawing and thus this only needs to be called |
87 * when the render target has been modified outside of Gr. This has no | 87 * when the render target has been modified outside of Gr. This has no |
88 * effect on wrapped backend render targets. | 88 * effect on wrapped backend render targets. |
89 * | 89 * |
90 * @param rect a rect bounding the area needing resolve. NULL indicates | 90 * @param rect a rect bounding the area needing resolve. NULL indicates |
91 * the whole RT needs resolving. | 91 * the whole RT needs resolving. |
92 */ | 92 */ |
93 void flagAsNeedingResolve(const GrIRect* rect = NULL); | 93 void flagAsNeedingResolve(const SkIRect* rect = NULL); |
94 | 94 |
95 /** | 95 /** |
96 * Call to override the region that needs to be resolved. | 96 * Call to override the region that needs to be resolved. |
97 */ | 97 */ |
98 void overrideResolveRect(const GrIRect rect); | 98 void overrideResolveRect(const SkIRect rect); |
99 | 99 |
100 /** | 100 /** |
101 * Call to indicate that GrRenderTarget was externally resolved. This may | 101 * Call to indicate that GrRenderTarget was externally resolved. This may |
102 * allow Gr to skip a redundant resolve step. | 102 * allow Gr to skip a redundant resolve step. |
103 */ | 103 */ |
104 void flagAsResolved() { fResolveRect.setLargestInverted(); } | 104 void flagAsResolved() { fResolveRect.setLargestInverted(); } |
105 | 105 |
106 /** | 106 /** |
107 * @return true if the GrRenderTarget requires MSAA resolving | 107 * @return true if the GrRenderTarget requires MSAA resolving |
108 */ | 108 */ |
109 bool needsResolve() const { return !fResolveRect.isEmpty(); } | 109 bool needsResolve() const { return !fResolveRect.isEmpty(); } |
110 | 110 |
111 /** | 111 /** |
112 * Returns a rect bounding the region needing resolving. | 112 * Returns a rect bounding the region needing resolving. |
113 */ | 113 */ |
114 const GrIRect& getResolveRect() const { return fResolveRect; } | 114 const SkIRect& getResolveRect() const { return fResolveRect; } |
115 | 115 |
116 /** | 116 /** |
117 * If the render target is multisampled this will perform a multisample | 117 * If the render target is multisampled this will perform a multisample |
118 * resolve. Any pending draws to the target are first flushed. This only | 118 * resolve. Any pending draws to the target are first flushed. This only |
119 * applies to render targets that are associated with GrTextures. After the | 119 * applies to render targets that are associated with GrTextures. After the |
120 * function returns the GrTexture will contain the resolved pixels. | 120 * function returns the GrTexture will contain the resolved pixels. |
121 */ | 121 */ |
122 void resolve(); | 122 void resolve(); |
123 | 123 |
124 // a MSAA RT may require explicit resolving , it may auto-resolve (e.g. FBO | 124 // a MSAA RT may require explicit resolving , it may auto-resolve (e.g. FBO |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 friend class GrTexture; | 156 friend class GrTexture; |
157 // called by ~GrTexture to remove the non-ref'ed back ptr. | 157 // called by ~GrTexture to remove the non-ref'ed back ptr. |
158 void owningTextureDestroyed() { | 158 void owningTextureDestroyed() { |
159 GrAssert(NULL != fTexture); | 159 GrAssert(NULL != fTexture); |
160 fTexture = NULL; | 160 fTexture = NULL; |
161 } | 161 } |
162 | 162 |
163 GrStencilBuffer* fStencilBuffer; | 163 GrStencilBuffer* fStencilBuffer; |
164 GrTexture* fTexture; // not ref'ed | 164 GrTexture* fTexture; // not ref'ed |
165 | 165 |
166 GrIRect fResolveRect; | 166 SkIRect fResolveRect; |
167 | 167 |
168 typedef GrSurface INHERITED; | 168 typedef GrSurface INHERITED; |
169 }; | 169 }; |
170 | 170 |
171 #endif | 171 #endif |
OLD | NEW |