Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: src/gpu/GrTextureParamsAdjuster.cpp

Issue 2063313002: Check for abandoned texture in GrTextureAdjuster::refTextureSafeForParams (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #include "GrTextureParamsAdjuster.h" 8 #include "GrTextureParamsAdjuster.h"
9 9
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& par ams, 160 GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& par ams,
161 SkSourceGammaTreatment gam maTreatment, 161 SkSourceGammaTreatment gam maTreatment,
162 SkIPoint* outOffset) { 162 SkIPoint* outOffset) {
163 GrTexture* texture = this->originalTexture(); 163 GrTexture* texture = this->originalTexture();
164 GrContext* context = texture->getContext(); 164 GrContext* context = texture->getContext();
165 CopyParams copyParams; 165 CopyParams copyParams;
166 const SkIRect* contentArea = this->contentAreaOrNull(); 166 const SkIRect* contentArea = this->contentAreaOrNull();
167 167
168 if (!context) {
169 // The texture was abandoned.
170 return nullptr;
171 }
172
168 if (contentArea && GrTextureParams::kMipMap_FilterMode == params.filterMode( )) { 173 if (contentArea && GrTextureParams::kMipMap_FilterMode == params.filterMode( )) {
169 // If we generate a MIP chain for texture it will read pixel values from outside the content 174 // If we generate a MIP chain for texture it will read pixel values from outside the content
170 // area. 175 // area.
171 copyParams.fWidth = contentArea->width(); 176 copyParams.fWidth = contentArea->width();
172 copyParams.fHeight = contentArea->height(); 177 copyParams.fHeight = contentArea->height();
173 copyParams.fFilter = GrTextureParams::kBilerp_FilterMode; 178 copyParams.fFilter = GrTextureParams::kBilerp_FilterMode;
174 } else if (!context->getGpu()->makeCopyForTextureParams(texture, params, &co pyParams)) { 179 } else if (!context->getGpu()->makeCopyForTextureParams(texture, params, &co pyParams)) {
175 if (outOffset) { 180 if (outOffset) {
176 if (contentArea) { 181 if (contentArea) {
177 outOffset->set(contentArea->fLeft, contentArea->fRight); 182 outOffset->set(contentArea->fLeft, contentArea->fRight);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 516 }
512 517
513 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped, 518 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped,
514 SkSourceGammaTreatment gamma Treatment) { 519 SkSourceGammaTreatment gamma Treatment) {
515 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment)); 520 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment));
516 if (!original) { 521 if (!original) {
517 return nullptr; 522 return nullptr;
518 } 523 }
519 return copy_on_gpu(original, nullptr, copyParams); 524 return copy_on_gpu(original, nullptr, copyParams);
520 } 525 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698