Index: src/core/SkPictureStateTree.cpp |
=================================================================== |
--- src/core/SkPictureStateTree.cpp (revision 12590) |
+++ src/core/SkPictureStateTree.cpp (working copy) |
@@ -11,19 +11,16 @@ |
SkPictureStateTree::SkPictureStateTree() |
: fAlloc(2048) |
- , fRoot(NULL) |
, fLastRestoredNode(NULL) |
, fStateStack(sizeof(Draw), 16) { |
- SkMatrix* identity = static_cast<SkMatrix*>(fAlloc.allocThrow(sizeof(SkMatrix))); |
- identity->reset(); |
- fRoot = static_cast<Node*>(fAlloc.allocThrow(sizeof(Node))); |
- fRoot->fParent = NULL; |
- fRoot->fMatrix = identity; |
- fRoot->fFlags = Node::kSave_Flag; |
- fRoot->fOffset = 0; |
- fRoot->fLevel = 0; |
- fCurrentState.fNode = fRoot; |
- fCurrentState.fMatrix = identity; |
+ fRootMatrix.reset(); |
+ fRoot.fParent = NULL; |
+ fRoot.fMatrix = &fRootMatrix; |
+ fRoot.fFlags = Node::kSave_Flag; |
+ fRoot.fOffset = 0; |
+ fRoot.fLevel = 0; |
+ fCurrentState.fNode = &fRoot; |
+ fCurrentState.fMatrix = &fRootMatrix; |
*static_cast<Draw*>(fStateStack.push_back()) = fCurrentState; |
} |
@@ -78,7 +75,7 @@ |
SkPictureStateTree::Iterator SkPictureStateTree::getIterator(const SkTDArray<void*>& draws, |
SkCanvas* canvas) { |
- return Iterator(draws, canvas, fRoot); |
+ return Iterator(draws, canvas, &fRoot); |
} |
void SkPictureStateTree::appendNode(uint32_t offset) { |