OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkPictureStateTree.h" | 9 #include "SkPictureStateTree.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 , fCurrentMatrix(NULL) | 96 , fCurrentMatrix(NULL) |
97 , fPlaybackIndex(0) | 97 , fPlaybackIndex(0) |
98 , fSave(false) | 98 , fSave(false) |
99 , fValid(true) { | 99 , fValid(true) { |
100 } | 100 } |
101 | 101 |
102 uint32_t SkPictureStateTree::Iterator::draw() { | 102 uint32_t SkPictureStateTree::Iterator::draw() { |
103 SkASSERT(this->isValid()); | 103 SkASSERT(this->isValid()); |
104 if (fPlaybackIndex >= fDraws->count()) { | 104 if (fPlaybackIndex >= fDraws->count()) { |
105 // restore back to where we started | 105 // restore back to where we started |
| 106 fCanvas->setMatrix(fPlaybackMatrix); |
106 if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) { fCanvas->restore();
} | 107 if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) { fCanvas->restore();
} |
107 fCurrentNode = fCurrentNode->fParent; | 108 fCurrentNode = fCurrentNode->fParent; |
108 while (NULL != fCurrentNode) { | 109 while (NULL != fCurrentNode) { |
109 if (fCurrentNode->fFlags & Node::kSave_Flag) { fCanvas->restore(); } | 110 if (fCurrentNode->fFlags & Node::kSave_Flag) { fCanvas->restore(); } |
110 if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) { fCanvas->restore
(); } | 111 if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) { fCanvas->restore
(); } |
111 fCurrentNode = fCurrentNode->fParent; | 112 fCurrentNode = fCurrentNode->fParent; |
112 } | 113 } |
113 fCanvas->setMatrix(fPlaybackMatrix); | |
114 return kDrawComplete; | 114 return kDrawComplete; |
115 } | 115 } |
116 | 116 |
117 Draw* draw = static_cast<Draw*>((*fDraws)[fPlaybackIndex]); | 117 Draw* draw = static_cast<Draw*>((*fDraws)[fPlaybackIndex]); |
118 Node* targetNode = draw->fNode; | 118 Node* targetNode = draw->fNode; |
119 | 119 |
120 if (fSave) { | 120 if (fSave) { |
121 fCanvas->save(SkCanvas::kClip_SaveFlag); | 121 fCanvas->save(SkCanvas::kClip_SaveFlag); |
122 fSave = false; | 122 fSave = false; |
123 } | 123 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (fCurrentMatrix != draw->fMatrix) { | 177 if (fCurrentMatrix != draw->fMatrix) { |
178 SkMatrix tmp = *draw->fMatrix; | 178 SkMatrix tmp = *draw->fMatrix; |
179 tmp.postConcat(fPlaybackMatrix); | 179 tmp.postConcat(fPlaybackMatrix); |
180 fCanvas->setMatrix(tmp); | 180 fCanvas->setMatrix(tmp); |
181 fCurrentMatrix = draw->fMatrix; | 181 fCurrentMatrix = draw->fMatrix; |
182 } | 182 } |
183 | 183 |
184 ++fPlaybackIndex; | 184 ++fPlaybackIndex; |
185 return draw->fOffset; | 185 return draw->fOffset; |
186 } | 186 } |
OLD | NEW |