OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
10 | 10 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 return tex; | 216 return tex; |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, | 220 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, |
221 GrWrapOwnership ownership) { | 221 GrWrapOwnership ownership) { |
222 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 222 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
223 return nullptr; | 223 return nullptr; |
224 } | 224 } |
225 this->handleDirtyContext(); | 225 this->handleDirtyContext(); |
226 return this->onWrapBackendRenderTarget(desc, ownership); | 226 auto res = this->onWrapBackendRenderTarget(desc, ownership); |
| 227 if (desc.fStencilBits) { |
| 228 // Our algorithms that use the stencil buffer assume it is |
| 229 // initially cleared. |
| 230 this->clearStencil(res); |
| 231 } |
| 232 return res; |
227 } | 233 } |
228 | 234 |
229 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
sc& desc) { | 235 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
sc& desc) { |
230 this->handleDirtyContext(); | 236 this->handleDirtyContext(); |
231 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { | 237 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { |
232 return nullptr; | 238 return nullptr; |
233 } | 239 } |
234 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 240 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
235 return nullptr; | 241 return nullptr; |
236 } | 242 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. | 495 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. |
490 if (a[i].x() != b[i].x()) { | 496 if (a[i].x() != b[i].x()) { |
491 return a[i].x() < b[i].x(); | 497 return a[i].x() < b[i].x(); |
492 } | 498 } |
493 if (a[i].y() != b[i].y()) { | 499 if (a[i].y() != b[i].y()) { |
494 return a[i].y() < b[i].y(); | 500 return a[i].y() < b[i].y(); |
495 } | 501 } |
496 } | 502 } |
497 return false; // Equal. | 503 return false; // Equal. |
498 } | 504 } |
OLD | NEW |