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

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

Issue 1107973004: Pull cache out of GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixpicturerenderer.cpp Created 5 years, 7 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/GrResourceProvider.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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 242
243 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n eedsRendering) { 243 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n eedsRendering) {
244 if (layer->locked()) { 244 if (layer->locked()) {
245 // This layer is already locked 245 // This layer is already locked
246 *needsRendering = false; 246 *needsRendering = false;
247 return true; 247 return true;
248 } 248 }
249 249
250 // TODO: make the test for exact match depend on the image filters themselve s 250 // TODO: make the test for exact match depend on the image filters themselve s
251 GrContext::ScratchTexMatch usage = GrContext::kApprox_ScratchTexMatch; 251 GrTextureProvider::ScratchTexMatch usage = GrTextureProvider::kApprox_Scratc hTexMatch;
252 if (layer->fFilter) { 252 if (layer->fFilter) {
253 usage = GrContext::kExact_ScratchTexMatch; 253 usage = GrTextureProvider::kExact_ScratchTexMatch;
254 } 254 }
255 255
256 SkAutoTUnref<GrTexture> tex(fContext->refScratchTexture(desc, usage)); 256 SkAutoTUnref<GrTexture> tex(fContext->textureProvider()->refScratchTexture(d esc, usage));
257 if (!tex) { 257 if (!tex) {
258 return false; 258 return false;
259 } 259 }
260 260
261 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight)); 261 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight));
262 layer->setLocked(true); 262 layer->setLocked(true);
263 *needsRendering = true; 263 *needsRendering = true;
264 return true; 264 return true;
265 } 265 }
266 266
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 fileName.appendf("\\%d", layer->fKey.pictureID()); 503 fileName.appendf("\\%d", layer->fKey.pictureID());
504 for (int i = 0; i < layer->fKey.keySize(); ++i) { 504 for (int i = 0; i < layer->fKey.keySize(); ++i) {
505 fileName.appendf("-%d", layer->fKey.key()[i]); 505 fileName.appendf("-%d", layer->fKey.key()[i]);
506 } 506 }
507 fileName.appendf(".png"); 507 fileName.appendf(".png");
508 508
509 layer->texture()->surfacePriv().savePixels(fileName.c_str()); 509 layer->texture()->surfacePriv().savePixels(fileName.c_str());
510 } 510 }
511 } 511 }
512 #endif 512 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698