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

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

Issue 638403003: Remove uses of GrAutoScratchTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 2 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 | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrSWMaskHelper.h » ('j') | 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 2014 Google Inc. 2 * Copyright 2014 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 "GrAtlas.h" 8 #include "GrAtlas.h"
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 #include "GrLayerCache.h" 10 #include "GrLayerCache.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // plausibly atlas-able). See if a plot can be purged and try again. 211 // plausibly atlas-able). See if a plot can be purged and try again.
212 if (!this->purgePlot()) { 212 if (!this->purgePlot()) {
213 break; // We weren't able to purge any plots 213 break; // We weren't able to purge any plots
214 } 214 }
215 } 215 }
216 } 216 }
217 217
218 // The texture wouldn't fit in the cache - give it it's own texture. 218 // The texture wouldn't fit in the cache - give it it's own texture.
219 // This path always uses a new scratch texture and (thus) doesn't cache anyt hing. 219 // This path always uses a new scratch texture and (thus) doesn't cache anyt hing.
220 // This can yield a lot of re-rendering 220 // This can yield a lot of re-rendering
221 SkAutoTUnref<GrTexture> tex(fContext->lockAndRefScratchTexture(desc, 221 SkAutoTUnref<GrTexture> tex(
222 GrContext::kApprox_Scrat chTexMatch)); 222 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch));
223 223
224 layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc. fHeight))); 224 layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc. fHeight)));
225 layer->setLocked(true); 225 layer->setLocked(true);
226 return true; 226 return true;
227 } 227 }
228 228
229 void GrLayerCache::unlock(GrCachedLayer* layer) { 229 void GrLayerCache::unlock(GrCachedLayer* layer) {
230 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);) 230 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);)
231 231
232 if (NULL == layer || !layer->locked()) { 232 if (NULL == layer || !layer->locked()) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 fileName.append("\\"); 458 fileName.append("\\");
459 fileName.appendU32(layer->fKey.pictureID()); 459 fileName.appendU32(layer->fKey.pictureID());
460 fileName.append("-"); 460 fileName.append("-");
461 fileName.appendU32(layer->fKey.start()); 461 fileName.appendU32(layer->fKey.start());
462 fileName.append(".png"); 462 fileName.append(".png");
463 463
464 layer->texture()->surfacePriv().savePixels(fileName.c_str()); 464 layer->texture()->surfacePriv().savePixels(fileName.c_str());
465 } 465 }
466 } 466 }
467 #endif 467 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrSWMaskHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698