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

Unified Diff: src/core/SkPictureStateTree.cpp

Issue 12817011: Fixing SkPicture command pattern optimizations to make them work correctly with bounding box hierar… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « src/core/SkPictureStateTree.h ('k') | src/core/SkRTree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureStateTree.cpp
===================================================================
--- src/core/SkPictureStateTree.cpp (revision 8135)
+++ src/core/SkPictureStateTree.cpp (working copy)
@@ -14,6 +14,7 @@
SkPictureStateTree::SkPictureStateTree()
: fAlloc(2048)
, fRoot(NULL)
+ , fLastRestoredNode(NULL)
, fStateStack(sizeof(Draw), 16) {
SkMatrix* identity = static_cast<SkMatrix*>(fAlloc.allocThrow(sizeof(SkMatrix)));
identity->reset();
@@ -49,7 +50,20 @@
fCurrentState.fNode->fFlags |= Node::kSaveLayer_Flag;
}
+void SkPictureStateTree::saveCollapsed() {
+ SkASSERT(NULL != fLastRestoredNode);
+ SkASSERT(SkToBool(fLastRestoredNode->fFlags & \
+ (Node::kSaveLayer_Flag | Node::kSave_Flag)));
+ SkASSERT(fLastRestoredNode->fParent == fCurrentState.fNode);
+ // The structure of the tree is not modified here. We just turn off
+ // the save or saveLayer flag to prevent the iterator from making state
+ // changing calls on the playback canvas when traversing a save or
+ // saveLayerNode node.
+ fLastRestoredNode->fFlags = 0;
+}
+
void SkPictureStateTree::appendRestore() {
+ fLastRestoredNode = fCurrentState.fNode;
fCurrentState = *static_cast<Draw*>(fStateStack.back());
fStateStack.pop_back();
}
« no previous file with comments | « src/core/SkPictureStateTree.h ('k') | src/core/SkRTree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698