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

Unified Diff: src/core/SkRecordDraw.cpp

Issue 753253002: Use variable length key (rather than accumulated matrix) as save layer hoisting key (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 6 years 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/core/SkRecordDraw.cpp
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 5e1fe7f0aa955bff31955a5755861586df5ac79e..54074808460dd032e3c54cedca1c81b9fa6e4e17 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -692,6 +692,13 @@ private:
dst.fRestoreOpID = src.fRestoreOpID;
dst.fHasNestedLayers = src.fHasNestedLayers;
dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested;
+
+ // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops from sub-picture'
+ dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1;
+ dst.fKey = SkNEW_ARRAY(int, dst.fKeySize);
+ memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count() * sizeof(int));
+ dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp();
+ memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySize * sizeof(int));
}
}
@@ -724,6 +731,7 @@ private:
if (isSaveLayer) {
this->updateStackForSaveLayer();
++fSaveLayersInStack;
+ fSaveLayerOpStack.push(fFillBounds.currentOp());
}
fSaveLayerStack.push(SaveLayerInfo(fFillBounds.currentOp(), isSaveLayer, paint));
@@ -735,6 +743,8 @@ private:
return;
}
+ SkASSERT(fSaveLayersInStack == fSaveLayerOpStack.count());
+
SaveLayerInfo sli;
fSaveLayerStack.pop(&sli);
@@ -758,12 +768,20 @@ private:
block.fRestoreOpID = fFillBounds.currentOp();
block.fHasNestedLayers = sli.fHasNestedSaveLayer;
block.fIsNested = fSaveLayersInStack > 0;
+
+ block.fKeySize = fSaveLayerOpStack.count();
+ block.fKey = SkNEW_ARRAY(int, block.fKeySize);
+ memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(int));
+
+ fSaveLayerOpStack.pop();
}
// Used to collect saveLayer information for layer hoisting
- int fSaveLayersInStack;
+ int fSaveLayersInStack;
SkTDArray<SaveLayerInfo> fSaveLayerStack;
- SkLayerInfo* fAccelData;
+ // The op code indices of all the currently active saveLayers
+ SkTDArray<int> fSaveLayerOpStack;
+ SkLayerInfo* fAccelData;
const SkPicture::SnapshotArray* fPictList;
SkRecords::FillBounds fFillBounds;
« no previous file with comments | « src/core/SkMultiPictureDraw.cpp ('k') | src/gpu/GrLayerCache.h » ('j') | src/gpu/GrLayerCache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698