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 auto res = this->onWrapBackendRenderTarget(desc, ownership); | 226 return 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; | |
233 } | 227 } |
234 | 228 |
235 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
sc& desc) { | 229 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
sc& desc) { |
236 this->handleDirtyContext(); | 230 this->handleDirtyContext(); |
237 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { | 231 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { |
238 return nullptr; | 232 return nullptr; |
239 } | 233 } |
240 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 234 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
241 return nullptr; | 235 return nullptr; |
242 } | 236 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. | 489 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. |
496 if (a[i].x() != b[i].x()) { | 490 if (a[i].x() != b[i].x()) { |
497 return a[i].x() < b[i].x(); | 491 return a[i].x() < b[i].x(); |
498 } | 492 } |
499 if (a[i].y() != b[i].y()) { | 493 if (a[i].y() != b[i].y()) { |
500 return a[i].y() < b[i].y(); | 494 return a[i].y() < b[i].y(); |
501 } | 495 } |
502 } | 496 } |
503 return false; // Equal. | 497 return false; // Equal. |
504 } | 498 } |
OLD | NEW |