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

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

Issue 1406013006: Update Layer Hoisting to store its atlas texture in the resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Android bug Created 5 years, 1 month 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/GrLayerHoister.h ('k') | src/gpu/GrRectanizer_skyline.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 "GrLayerCache.h" 8 #include "GrLayerCache.h"
9 #include "GrLayerHoister.h" 9 #include "GrLayerHoister.h"
10 #include "GrRecordReplaceDraw.h" 10 #include "GrRecordReplaceDraw.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 SkImageFilter::DeviceProxy proxy(device); 316 SkImageFilter::DeviceProxy proxy(device);
317 const SkBitmap src = wrap_texture(layer->texture()); 317 const SkBitmap src = wrap_texture(layer->texture());
318 318
319 if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitma p, &offset)) { 319 if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitma p, &offset)) {
320 // Filtering failed. Press on with the unfiltered version. 320 // Filtering failed. Press on with the unfiltered version.
321 return; 321 return;
322 } 322 }
323 323
324 SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.hei ght()); 324 SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.hei ght());
325 layer->setTexture(filteredBitmap.getTexture(), newRect); 325 layer->setTexture(filteredBitmap.getTexture(), newRect, false);
326 layer->setOffset(offset); 326 layer->setOffset(offset);
327 } 327 }
328 328
329 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay er>& layers) { 329 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay er>& layers) {
330 for (int i = 0; i < layers.count(); ++i) { 330 for (int i = 0; i < layers.count(); ++i) {
331 GrCachedLayer* layer = layers[i].fLayer; 331 GrCachedLayer* layer = layers[i].fLayer;
332 const SkBigPicture* pict = layers[i].fPicture->asSkBigPicture(); 332 const SkBigPicture* pict = layers[i].fPicture->asSkBigPicture();
333 if (!pict) { 333 if (!pict) {
334 // TODO: can we assume / assert this? 334 // TODO: can we assume / assert this?
335 continue; 335 continue;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 const SkTDArray<GrHoistedLayer>& layers) { 373 const SkTDArray<GrHoistedLayer>& layers) {
374 GrLayerCache* layerCache = context->getLayerCache(); 374 GrLayerCache* layerCache = context->getLayerCache();
375 375
376 for (int i = 0; i < layers.count(); ++i) { 376 for (int i = 0; i < layers.count(); ++i) {
377 layerCache->removeUse(layers[i].fLayer); 377 layerCache->removeUse(layers[i].fLayer);
378 } 378 }
379 379
380 SkDEBUGCODE(layerCache->validate();) 380 SkDEBUGCODE(layerCache->validate();)
381 } 381 }
382 382
383 void GrLayerHoister::PurgeCache(GrContext* context) { 383 void GrLayerHoister::Begin(GrContext* context) {
384 GrLayerCache* layerCache = context->getLayerCache();
385
386 layerCache->begin();
387 }
388
389 void GrLayerHoister::End(GrContext* context) {
390 GrLayerCache* layerCache = context->getLayerCache();
391
384 #if !GR_CACHE_HOISTED_LAYERS 392 #if !GR_CACHE_HOISTED_LAYERS
385 GrLayerCache* layerCache = context->getLayerCache();
386 393
387 // This code completely clears out the atlas. It is required when 394 // This code completely clears out the atlas. It is required when
388 // caching is disabled so the atlas doesn't fill up and force more 395 // caching is disabled so the atlas doesn't fill up and force more
389 // free floating layers 396 // free floating layers
390 layerCache->purgeAll(); 397 layerCache->purgeAll();
391 #endif 398 #endif
399
400 layerCache->end();
392 } 401 }
OLDNEW
« no previous file with comments | « src/gpu/GrLayerHoister.h ('k') | src/gpu/GrRectanizer_skyline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698