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 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 kCantResolve_ResolveType, | 137 kCantResolve_ResolveType, |
138 }; | 138 }; |
139 virtual ResolveType getResolveType() const = 0; | 139 virtual ResolveType getResolveType() const = 0; |
140 | 140 |
141 /** | 141 /** |
142 * Return the native ID or handle to the rendertarget, depending on the | 142 * Return the native ID or handle to the rendertarget, depending on the |
143 * platform. e.g. on OpenGL, return the FBO ID. | 143 * platform. e.g. on OpenGL, return the FBO ID. |
144 */ | 144 */ |
145 virtual GrBackendObject getRenderTargetHandle() const = 0; | 145 virtual GrBackendObject getRenderTargetHandle() const = 0; |
146 | 146 |
| 147 // Checked when this object is asked to attach a stencil buffer. |
| 148 virtual bool canAttemptStencilAttachment() const = 0; |
| 149 |
147 // Provides access to functions that aren't part of the public API. | 150 // Provides access to functions that aren't part of the public API. |
148 GrRenderTargetPriv renderTargetPriv(); | 151 GrRenderTargetPriv renderTargetPriv(); |
149 const GrRenderTargetPriv renderTargetPriv() const; | 152 const GrRenderTargetPriv renderTargetPriv() const; |
150 | 153 |
151 protected: | 154 protected: |
152 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, | 155 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, |
153 SampleConfig sampleConfig) | 156 SampleConfig sampleConfig, GrStencilAttachment* stencil = nul
lptr) |
154 : INHERITED(gpu, lifeCycle, desc) | 157 : INHERITED(gpu, lifeCycle, desc) |
155 , fStencilAttachment(NULL) | 158 , fStencilAttachment(stencil) |
156 , fSampleConfig(sampleConfig) { | 159 , fSampleConfig(sampleConfig) { |
157 fResolveRect.setLargestInverted(); | 160 fResolveRect.setLargestInverted(); |
158 } | 161 } |
159 | 162 |
160 // override of GrResource | 163 // override of GrResource |
161 void onAbandon() override; | 164 void onAbandon() override; |
162 void onRelease() override; | 165 void onRelease() override; |
163 | 166 |
164 private: | 167 private: |
165 // Checked when this object is asked to attach a stencil buffer. | 168 // Allows the backends to perform any additional work that is required for a
ttaching a |
166 virtual bool canAttemptStencilAttachment() const = 0; | 169 // GrStencilAttachment. When this is called, the GrStencilAttachment has alr
eady been put onto |
| 170 // the GrRenderTarget. This function must return false if any failures occur
when completing the |
| 171 // stencil attachment. |
| 172 virtual bool completeStencilAttachment() = 0; |
167 | 173 |
168 friend class GrRenderTargetPriv; | 174 friend class GrRenderTargetPriv; |
169 | 175 |
170 GrStencilAttachment* fStencilAttachment; | 176 GrStencilAttachment* fStencilAttachment; |
171 SampleConfig fSampleConfig; | 177 SampleConfig fSampleConfig; |
172 | 178 |
173 SkIRect fResolveRect; | 179 SkIRect fResolveRect; |
174 | 180 |
175 typedef GrSurface INHERITED; | 181 typedef GrSurface INHERITED; |
176 }; | 182 }; |
177 | 183 |
178 | 184 |
179 #endif | 185 #endif |
OLD | NEW |