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

Unified Diff: src/gpu/GrLayerHoister.cpp

Issue 748853002: Add support for hoisting layers in pictures drawn with a matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrLayerHoister.h ('k') | src/gpu/GrRecordReplaceDraw.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerHoister.cpp
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index b53c1b80cdda6be05f85d3e544abeb6572cd51e0..b7653ee295705fd2be324fde08a23dc016caf7ae 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -19,6 +19,7 @@
// required texture/render target resources.
static void prepare_for_hoisting(GrLayerCache* layerCache,
const SkPicture* topLevelPicture,
+ const SkMatrix& matrix,
const SkLayerInfo::BlockInfo& info,
const SkIRect& layerRect,
SkTDArray<GrHoistedLayer>* needRendering,
@@ -27,7 +28,9 @@ static void prepare_for_hoisting(GrLayerCache* layerCache,
int numSamples) {
const SkPicture* pict = info.fPicture ? info.fPicture : topLevelPicture;
- SkMatrix combined = SkMatrix::Concat(info.fPreMat, info.fLocalMat);
+ SkMatrix combined = matrix;
+ combined.preConcat(info.fPreMat);
+ combined.preConcat(info.fLocalMat);
GrCachedLayer* layer = layerCache->findLayerOrCreate(pict->uniqueID(),
info.fSaveLayerOpID,
@@ -73,7 +76,8 @@ static void prepare_for_hoisting(GrLayerCache* layerCache,
hl->fPicture = pict;
hl->fOffset = SkIPoint::Make(layerRect.fLeft, layerRect.fTop);
hl->fLocalMat = info.fLocalMat;
- hl->fPreMat = info.fPreMat;
+ hl->fPreMat = matrix;
+ hl->fPreMat.preConcat(info.fPreMat);
}
// Atlased layers must be small enough to fit in the atlas, not have a
@@ -81,6 +85,7 @@ static void prepare_for_hoisting(GrLayerCache* layerCache,
// TODO: allow leaf nested layers to appear in the atlas.
void GrLayerHoister::FindLayersToAtlas(GrContext* context,
const SkPicture* topLevelPicture,
+ const SkMatrix& initialMat,
const SkRect& query,
SkTDArray<GrHoistedLayer>* atlased,
SkTDArray<GrHoistedLayer>* recycled,
@@ -119,25 +124,27 @@ void GrLayerHoister::FindLayersToAtlas(GrContext* context,
continue;
}
- SkRect layerRect = info.fBounds;
+ SkRect layerRect;
+ initialMat.mapRect(&layerRect, info.fBounds);
if (!layerRect.intersect(query)) {
continue;
}
- SkIRect ir;
- layerRect.roundOut(&ir);
+ const SkIRect ir = layerRect.roundOut();
if (!GrLayerCache::PlausiblyAtlasable(ir.width(), ir.height())) {
continue;
}
- prepare_for_hoisting(layerCache, topLevelPicture, info, ir, atlased, recycled, true, 0);
+ prepare_for_hoisting(layerCache, topLevelPicture, initialMat,
+ info, ir, atlased, recycled, true, 0);
}
}
void GrLayerHoister::FindLayersToHoist(GrContext* context,
const SkPicture* topLevelPicture,
+ const SkMatrix& initialMat,
const SkRect& query,
SkTDArray<GrHoistedLayer>* needRendering,
SkTDArray<GrHoistedLayer>* recycled,
@@ -166,15 +173,15 @@ void GrLayerHoister::FindLayersToHoist(GrContext* context,
continue;
}
- SkRect layerRect = info.fBounds;
+ SkRect layerRect;
+ initialMat.mapRect(&layerRect, info.fBounds);
if (!layerRect.intersect(query)) {
continue;
}
- SkIRect ir;
- layerRect.roundOut(&ir);
+ const SkIRect ir = layerRect.roundOut();
- prepare_for_hoisting(layerCache, topLevelPicture, info, ir,
+ prepare_for_hoisting(layerCache, topLevelPicture, initialMat, info, ir,
needRendering, recycled, false, numSamples);
}
}
« no previous file with comments | « src/gpu/GrLayerHoister.h ('k') | src/gpu/GrRecordReplaceDraw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698