| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (tex) { | 171 if (tex) { |
| 172 if (!caps->reuseScratchTextures() && !isRT) { | 172 if (!caps->reuseScratchTextures() && !isRT) { |
| 173 tex->resourcePriv().removeScratchKey(); | 173 tex->resourcePriv().removeScratchKey(); |
| 174 } | 174 } |
| 175 fStats.incTextureCreates(); | 175 fStats.incTextureCreates(); |
| 176 if (!texels.empty()) { | 176 if (!texels.empty()) { |
| 177 if (texels[0].fPixels) { | 177 if (texels[0].fPixels) { |
| 178 fStats.incTextureUploads(); | 178 fStats.incTextureUploads(); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 if (isRT && texels.empty()) { |
| 182 GrRenderTarget* rt = tex->asRenderTarget(); |
| 183 SkASSERT(rt); |
| 184 rt->discard(); |
| 185 } |
| 181 } | 186 } |
| 182 return tex; | 187 return tex; |
| 183 } | 188 } |
| 184 | 189 |
| 185 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
ership ownership) { | 190 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
ership ownership) { |
| 186 this->handleDirtyContext(); | 191 this->handleDirtyContext(); |
| 187 if (!this->caps()->isConfigTexturable(desc.fConfig)) { | 192 if (!this->caps()->isConfigTexturable(desc.fConfig)) { |
| 188 return nullptr; | 193 return nullptr; |
| 189 } | 194 } |
| 190 if ((desc.fFlags & kRenderTarget_GrBackendTextureFlag) && | 195 if ((desc.fFlags & kRenderTarget_GrBackendTextureFlag) && |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); | 470 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); |
| 466 } | 471 } |
| 467 fMultisampleSpecsMap[effectiveKey] = &specs; | 472 fMultisampleSpecsMap[effectiveKey] = &specs; |
| 468 if (effectiveSampleCnt != desc.fSampleCnt) { | 473 if (effectiveSampleCnt != desc.fSampleCnt) { |
| 469 SkASSERT(surfDescKey < effectiveKey); | 474 SkASSERT(surfDescKey < effectiveKey); |
| 470 fMultisampleSpecsMap[surfDescKey] = &specs; | 475 fMultisampleSpecsMap[surfDescKey] = &specs; |
| 471 } | 476 } |
| 472 return specs; | 477 return specs; |
| 473 } | 478 } |
| 474 | 479 |
| OLD | NEW |