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

Side by Side Diff: src/core/SkPictureStateTree.h

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 */ 56 */
57 Iterator getIterator(const SkTDArray<void*>& draws, SkCanvas* canvas); 57 Iterator getIterator(const SkTDArray<void*>& draws, SkCanvas* canvas);
58 58
59 void appendSave(); 59 void appendSave();
60 void appendSaveLayer(uint32_t offset); 60 void appendSaveLayer(uint32_t offset);
61 void appendRestore(); 61 void appendRestore();
62 void appendTransform(const SkMatrix& trans); 62 void appendTransform(const SkMatrix& trans);
63 void appendClip(uint32_t offset); 63 void appendClip(uint32_t offset);
64 64
65 /** 65 /**
66 * Call this immediately after an appendRestore call that is associated
67 * a save or saveLayer that was removed from the command stream
68 * due to a command pattern optimization in SkPicture.
69 */
70 void saveCollapsed();
71
72 /**
66 * Playback helper 73 * Playback helper
67 */ 74 */
68 class Iterator { 75 class Iterator {
69 public: 76 public:
70 /** 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. */
71 uint32_t draw(); 78 uint32_t draw();
72 static const uint32_t kDrawComplete = SK_MaxU32; 79 static const uint32_t kDrawComplete = SK_MaxU32;
73 Iterator() : fPlaybackMatrix(), fValid(false) { } 80 Iterator() : fPlaybackMatrix(), fValid(false) { }
74 bool isValid() const { return fValid; } 81 bool isValid() const { return fValid; }
75 private: 82 private:
(...skipping 25 matching lines...) Expand all
101 bool fValid; 108 bool fValid;
102 109
103 friend class SkPictureStateTree; 110 friend class SkPictureStateTree;
104 }; 111 };
105 112
106 private: 113 private:
107 114
108 void appendNode(uint32_t offset); 115 void appendNode(uint32_t offset);
109 116
110 SkChunkAlloc fAlloc; 117 SkChunkAlloc fAlloc;
111 Node* fRoot; 118 Node* fRoot;
robertphillips 2013/03/14 18:55:44 Do we want a comment like: // ideally the state tr
Justin Novosad 2013/03/14 20:04:14 Done.
119 Node* fLastRestoredNode;
112 120
113 // The currently active state 121 // The currently active state
114 Draw fCurrentState; 122 Draw fCurrentState;
115 // A stack of states for tracking save/restores 123 // A stack of states for tracking save/restores
116 SkDeque fStateStack; 124 SkDeque fStateStack;
117 125
118 // Represents a notable piece of state that requires an offset into the comm and buffer, 126 // Represents a notable piece of state that requires an offset into the comm and buffer,
119 // corresponding to a clip/saveLayer/etc call, to apply. 127 // corresponding to a clip/saveLayer/etc call, to apply.
120 struct Node { 128 struct Node {
121 Node* fParent; 129 Node* fParent;
122 uint32_t fOffset; 130 uint32_t fOffset;
123 uint16_t fLevel; 131 uint16_t fLevel;
124 uint16_t fFlags; 132 uint16_t fFlags;
125 SkMatrix* fMatrix; 133 SkMatrix* fMatrix;
126 enum Flags { 134 enum Flags {
127 kSave_Flag = 0x1, 135 kSave_Flag = 0x1,
128 kSaveLayer_Flag = 0x2 136 kSaveLayer_Flag = 0x2
129 }; 137 };
130 }; 138 };
131 139
132 typedef SkRefCnt INHERITED; 140 typedef SkRefCnt INHERITED;
133 }; 141 };
134 142
135 #endif 143 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698