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

Unified Diff: src/gpu/GrLayerHoister.cpp

Issue 616023002: Allow previously-hoisted layers to be reused in the same draw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comments Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrLayerHoister.cpp
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index f2e6560a18a138f066b6ce770c8e2797bb1cf0ef..8143bdc375abbab8bf7ff294104f843b9e525b7c 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -18,6 +18,7 @@ bool GrLayerHoister::FindLayersToHoist(const SkPicture* topLevelPicture,
const SkRect& query,
SkTDArray<HoistedLayer>* atlased,
SkTDArray<HoistedLayer>* nonAtlased,
+ SkTDArray<HoistedLayer>* recycled,
GrLayerCache* layerCache) {
bool anyHoisted = false;
@@ -101,20 +102,22 @@ bool GrLayerHoister::FindLayersToHoist(const SkPicture* topLevelPicture,
continue;
}
- if (needsRendering) {
- HoistedLayer* hl;
+ HoistedLayer* hl;
+ if (needsRendering) {
if (layer->isAtlased()) {
hl = atlased->append();
} else {
hl = nonAtlased->append();
}
-
- hl->fLayer = layer;
- hl->fPicture = pict;
- hl->fOffset = info.fOffset;
- hl->fCTM = info.fOriginXform;
+ } else {
+ hl = recycled->append();
}
+
+ hl->fLayer = layer;
+ hl->fPicture = pict;
+ hl->fOffset = info.fOffset;
+ hl->fCTM = info.fOriginXform;
}
}
@@ -160,6 +163,7 @@ static void convert_layers_to_replacements(const SkTDArray<GrLayerHoister::Hoist
void GrLayerHoister::DrawLayers(const SkTDArray<HoistedLayer>& atlased,
const SkTDArray<HoistedLayer>& nonAtlased,
+ const SkTDArray<HoistedLayer>& recycled,
GrReplacements* replacements) {
// Render the atlased layers that require it
if (atlased.count() > 0) {
@@ -253,6 +257,7 @@ void GrLayerHoister::DrawLayers(const SkTDArray<HoistedLayer>& atlased,
convert_layers_to_replacements(atlased, replacements);
convert_layers_to_replacements(nonAtlased, replacements);
+ convert_layers_to_replacements(recycled, replacements);
}
static void unlock_layer_in_cache(GrLayerCache* layerCache,
@@ -270,7 +275,8 @@ static void unlock_layer_in_cache(GrLayerCache* layerCache,
void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache,
const SkTDArray<HoistedLayer>& atlased,
- const SkTDArray<HoistedLayer>& nonAtlased) {
+ const SkTDArray<HoistedLayer>& nonAtlased,
+ const SkTDArray<HoistedLayer>& recycled) {
for (int i = 0; i < atlased.count(); ++i) {
unlock_layer_in_cache(layerCache, atlased[i].fPicture, atlased[i].fLayer);
@@ -280,6 +286,10 @@ void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache,
unlock_layer_in_cache(layerCache, nonAtlased[i].fPicture, nonAtlased[i].fLayer);
}
+ for (int i = 0; i < recycled.count(); ++i) {
+ unlock_layer_in_cache(layerCache, recycled[i].fPicture, recycled[i].fLayer);
+ }
+
#if DISABLE_CACHING
// This code completely clears out the atlas. It is required when
// caching is disabled so the atlas doesn't fill up and force more
« no previous file with comments | « src/gpu/GrLayerHoister.h ('k') | src/gpu/GrPictureUtils.cpp » ('j') | src/gpu/GrPictureUtils.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698