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 GrCaps; | |
15 class GrDrawTarget; | 14 class GrDrawTarget; |
16 class GrStencilAttachment; | 15 class GrStencilAttachment; |
17 class GrRenderTargetPriv; | 16 class GrRenderTargetPriv; |
18 | 17 |
19 /** | 18 /** |
20 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. | 19 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. |
21 * A context's render target is set by setRenderTarget(). Render targets are | 20 * A context's render target is set by setRenderTarget(). Render targets are |
22 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. | 21 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. |
23 * Additionally, GrContext provides methods for creating GrRenderTargets | 22 * Additionally, GrContext provides methods for creating GrRenderTargets |
24 * that wrap externally created render targets. | 23 * that wrap externally created render targets. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Checked when this object is asked to attach a stencil buffer. | 148 // Checked when this object is asked to attach a stencil buffer. |
150 virtual bool canAttemptStencilAttachment() const = 0; | 149 virtual bool canAttemptStencilAttachment() const = 0; |
151 | 150 |
152 // Provides access to functions that aren't part of the public API. | 151 // Provides access to functions that aren't part of the public API. |
153 GrRenderTargetPriv renderTargetPriv(); | 152 GrRenderTargetPriv renderTargetPriv(); |
154 const GrRenderTargetPriv renderTargetPriv() const; | 153 const GrRenderTargetPriv renderTargetPriv() const; |
155 | 154 |
156 void setLastDrawTarget(GrDrawTarget* dt); | 155 void setLastDrawTarget(GrDrawTarget* dt); |
157 GrDrawTarget* getLastDrawTarget() { return fLastDrawTarget; } | 156 GrDrawTarget* getLastDrawTarget() { return fLastDrawTarget; } |
158 | 157 |
159 static SampleConfig ComputeSampleConfig(const GrCaps& caps, int sampleCnt); | |
160 | |
161 protected: | 158 protected: |
162 GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc, | 159 GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc, |
163 SampleConfig sampleConfig, GrStencilAttachment* stencil = nul
lptr) | 160 SampleConfig sampleConfig, GrStencilAttachment* stencil = nul
lptr) |
164 : INHERITED(gpu, desc) | 161 : INHERITED(gpu, desc) |
165 , fStencilAttachment(stencil) | 162 , fStencilAttachment(stencil) |
166 , fSampleConfig(sampleConfig) | 163 , fSampleConfig(sampleConfig) |
167 , fLastDrawTarget(nullptr) { | 164 , fLastDrawTarget(nullptr) { |
168 fResolveRect.setLargestInverted(); | 165 fResolveRect.setLargestInverted(); |
169 } | 166 } |
170 | 167 |
(...skipping 23 matching lines...) Expand all Loading... |
194 // This back-pointer is required so that we can add a dependancy between | 191 // This back-pointer is required so that we can add a dependancy between |
195 // the drawTarget used to create the current contents of this renderTarget | 192 // the drawTarget used to create the current contents of this renderTarget |
196 // and the drawTarget of a destination renderTarget to which this one is bei
ng drawn. | 193 // and the drawTarget of a destination renderTarget to which this one is bei
ng drawn. |
197 GrDrawTarget* fLastDrawTarget; | 194 GrDrawTarget* fLastDrawTarget; |
198 | 195 |
199 typedef GrSurface INHERITED; | 196 typedef GrSurface INHERITED; |
200 }; | 197 }; |
201 | 198 |
202 | 199 |
203 #endif | 200 #endif |
OLD | NEW |