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 nextDraw(); | 78 uint32_t draw(); |
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 | |
83 private: | 82 private: |
84 Iterator(const SkTDArray<void*>& draws, SkCanvas* canvas, Node* root); | 83 Iterator(const SkTDArray<void*>& draws, SkCanvas* canvas, Node* root); |
85 | |
86 void setCurrentMatrix(const SkMatrix*); | |
87 | |
88 // The draws this iterator is associated with | 84 // The draws this iterator is associated with |
89 const SkTDArray<void*>* fDraws; | 85 const SkTDArray<void*>* fDraws; |
90 | 86 |
91 // canvas this is playing into (so we can insert saves/restores as neces
sary) | 87 // canvas this is playing into (so we can insert saves/restores as neces
sary) |
92 SkCanvas* fCanvas; | 88 SkCanvas* fCanvas; |
93 | 89 |
94 // current state node | 90 // current state node |
95 Node* fCurrentNode; | 91 Node* fCurrentNode; |
96 | 92 |
97 // List of nodes whose state we need to apply to reach TargetNode | 93 // List of nodes whose state we need to apply to reach TargetNode |
98 SkTDArray<Node*> fNodes; | 94 SkTDArray<Node*> fNodes; |
99 | 95 |
100 // The matrix of the canvas we're playing back into | 96 // The matrix of the canvas we're playing back into |
101 const SkMatrix fPlaybackMatrix; | 97 const SkMatrix fPlaybackMatrix; |
102 | 98 |
103 // Cache of current matrix, so we can avoid redundantly setting it | 99 // Cache of current matrix, so we can avoid redundantly setting it |
104 const SkMatrix* fCurrentMatrix; | 100 SkMatrix* fCurrentMatrix; |
105 | 101 |
106 // current position in the array of draws | 102 // current position in the array of draws |
107 int fPlaybackIndex; | 103 int fPlaybackIndex; |
108 // Whether or not we need to do a save next iteration | 104 // Whether or not we need to do a save next iteration |
109 bool fSave; | 105 bool fSave; |
110 | 106 |
111 // Whether or not this is a valid iterator (the default public construct
or sets this false) | 107 // Whether or not this is a valid iterator (the default public construct
or sets this false) |
112 bool fValid; | 108 bool fValid; |
113 | 109 |
114 friend class SkPictureStateTree; | 110 friend class SkPictureStateTree; |
(...skipping 28 matching lines...) Expand all Loading... |
143 }; | 139 }; |
144 }; | 140 }; |
145 | 141 |
146 Node fRoot; | 142 Node fRoot; |
147 SkMatrix fRootMatrix; | 143 SkMatrix fRootMatrix; |
148 | 144 |
149 typedef SkRefCnt INHERITED; | 145 typedef SkRefCnt INHERITED; |
150 }; | 146 }; |
151 | 147 |
152 #endif | 148 #endif |
OLD | NEW |