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

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

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 years, 4 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
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 "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 244
245 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n eedsRendering) { 245 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n eedsRendering) {
246 if (layer->locked()) { 246 if (layer->locked()) {
247 // This layer is already locked 247 // This layer is already locked
248 *needsRendering = false; 248 *needsRendering = false;
249 return true; 249 return true;
250 } 250 }
251 251
252 // TODO: make the test for exact match depend on the image filters themselve s 252 // TODO: make the test for exact match depend on the image filters themselve s
253 GrTextureProvider::ScratchTexMatch usage = GrTextureProvider::kApprox_Scratc hTexMatch; 253 SkAutoTUnref<GrTexture> tex;
254 if (layer->fFilter) { 254 if (layer->fFilter) {
255 usage = GrTextureProvider::kExact_ScratchTexMatch; 255 tex.reset(fContext->textureProvider()->createTexture(desc, true));
256 } else {
257 tex.reset(fContext->textureProvider()->createApproxTexture(desc));
256 } 258 }
257 259
258 SkAutoTUnref<GrTexture> tex(fContext->textureProvider()->refScratchTexture(d esc, usage));
259 if (!tex) { 260 if (!tex) {
260 return false; 261 return false;
261 } 262 }
262 263
263 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight)); 264 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight));
264 layer->setLocked(true); 265 layer->setLocked(true);
265 *needsRendering = true; 266 *needsRendering = true;
266 return true; 267 return true;
267 } 268 }
268 269
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 fileName.appendf("\\%d", layer->fKey.pictureID()); 510 fileName.appendf("\\%d", layer->fKey.pictureID());
510 for (int i = 0; i < layer->fKey.keySize(); ++i) { 511 for (int i = 0; i < layer->fKey.keySize(); ++i) {
511 fileName.appendf("-%d", layer->fKey.key()[i]); 512 fileName.appendf("-%d", layer->fKey.key()[i]);
512 } 513 }
513 fileName.appendf(".png"); 514 fileName.appendf(".png");
514 515
515 layer->texture()->surfacePriv().savePixels(fileName.c_str()); 516 layer->texture()->surfacePriv().savePixels(fileName.c_str());
516 } 517 }
517 } 518 }
518 #endif 519 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698