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 #ifndef SkPictureStateTree_DEFINED | 9 #ifndef SkPictureStateTree_DEFINED |
10 #define SkPictureStateTree_DEFINED | 10 #define SkPictureStateTree_DEFINED |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 * due to a command pattern optimization in SkPicture. | 68 * due to a command pattern optimization in SkPicture. |
69 */ | 69 */ |
70 void saveCollapsed(); | 70 void saveCollapsed(); |
71 | 71 |
72 /** | 72 /** |
73 * Playback helper | 73 * Playback helper |
74 */ | 74 */ |
75 class Iterator { | 75 class Iterator { |
76 public: | 76 public: |
77 /** Returns the next offset into the picture stream, or kDrawComplete if
complete. */ | 77 /** Returns the next offset into the picture stream, or kDrawComplete if
complete. */ |
78 uint32_t draw(); | 78 uint32_t nextDraw(); |
79 static const uint32_t kDrawComplete = SK_MaxU32; | 79 static const uint32_t kDrawComplete = SK_MaxU32; |
80 Iterator() : fPlaybackMatrix(), fValid(false) { } | 80 Iterator() : fPlaybackMatrix(), fValid(false) { } |
81 bool isValid() const { return fValid; } | 81 bool isValid() const { return fValid; } |
| 82 |
82 private: | 83 private: |
83 Iterator(const SkTDArray<void*>& draws, SkCanvas* canvas, Node* root); | 84 Iterator(const SkTDArray<void*>& draws, SkCanvas* canvas, Node* root); |
| 85 |
| 86 void setCurrentMatrix(const SkMatrix*); |
| 87 |
84 // The draws this iterator is associated with | 88 // The draws this iterator is associated with |
85 const SkTDArray<void*>* fDraws; | 89 const SkTDArray<void*>* fDraws; |
86 | 90 |
87 // canvas this is playing into (so we can insert saves/restores as neces
sary) | 91 // canvas this is playing into (so we can insert saves/restores as neces
sary) |
88 SkCanvas* fCanvas; | 92 SkCanvas* fCanvas; |
89 | 93 |
90 // current state node | 94 // current state node |
91 Node* fCurrentNode; | 95 Node* fCurrentNode; |
92 | 96 |
93 // List of nodes whose state we need to apply to reach TargetNode | 97 // List of nodes whose state we need to apply to reach TargetNode |
94 SkTDArray<Node*> fNodes; | 98 SkTDArray<Node*> fNodes; |
95 | 99 |
96 // The matrix of the canvas we're playing back into | 100 // The matrix of the canvas we're playing back into |
97 const SkMatrix fPlaybackMatrix; | 101 const SkMatrix fPlaybackMatrix; |
98 | 102 |
99 // Cache of current matrix, so we can avoid redundantly setting it | 103 // Cache of current matrix, so we can avoid redundantly setting it |
100 SkMatrix* fCurrentMatrix; | 104 const SkMatrix* fCurrentMatrix; |
101 | 105 |
102 // current position in the array of draws | 106 // current position in the array of draws |
103 int fPlaybackIndex; | 107 int fPlaybackIndex; |
104 // Whether or not we need to do a save next iteration | 108 // Whether or not we need to do a save next iteration |
105 bool fSave; | 109 bool fSave; |
106 | 110 |
107 // Whether or not this is a valid iterator (the default public construct
or sets this false) | 111 // Whether or not this is a valid iterator (the default public construct
or sets this false) |
108 bool fValid; | 112 bool fValid; |
109 | 113 |
110 friend class SkPictureStateTree; | 114 friend class SkPictureStateTree; |
(...skipping 28 matching lines...) Expand all Loading... |
139 }; | 143 }; |
140 }; | 144 }; |
141 | 145 |
142 Node fRoot; | 146 Node fRoot; |
143 SkMatrix fRootMatrix; | 147 SkMatrix fRootMatrix; |
144 | 148 |
145 typedef SkRefCnt INHERITED; | 149 typedef SkRefCnt INHERITED; |
146 }; | 150 }; |
147 | 151 |
148 #endif | 152 #endif |
OLD | NEW |