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

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

Issue 111573002: Avoid heap allocation in SkPictureStateTree constructor (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | src/core/SkPictureStateTree.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool fValid; 108 bool fValid;
109 109
110 friend class SkPictureStateTree; 110 friend class SkPictureStateTree;
111 }; 111 };
112 112
113 private: 113 private:
114 114
115 void appendNode(uint32_t offset); 115 void appendNode(uint32_t offset);
116 116
117 SkChunkAlloc fAlloc; 117 SkChunkAlloc fAlloc;
118 Node* fRoot;
119 // Needed by saveCollapsed() because nodes do not currently store 118 // Needed by saveCollapsed() because nodes do not currently store
120 // references to their children. If they did, we could just retrieve the 119 // references to their children. If they did, we could just retrieve the
121 // last added child. 120 // last added child.
122 Node* fLastRestoredNode; 121 Node* fLastRestoredNode;
123 122
124 // The currently active state 123 // The currently active state
125 Draw fCurrentState; 124 Draw fCurrentState;
126 // A stack of states for tracking save/restores 125 // A stack of states for tracking save/restores
127 SkDeque fStateStack; 126 SkDeque fStateStack;
128 127
129 // Represents a notable piece of state that requires an offset into the comm and buffer, 128 // Represents a notable piece of state that requires an offset into the comm and buffer,
130 // corresponding to a clip/saveLayer/etc call, to apply. 129 // corresponding to a clip/saveLayer/etc call, to apply.
131 struct Node { 130 struct Node {
132 Node* fParent; 131 Node* fParent;
133 uint32_t fOffset; 132 uint32_t fOffset;
134 uint16_t fLevel; 133 uint16_t fLevel;
135 uint16_t fFlags; 134 uint16_t fFlags;
136 SkMatrix* fMatrix; 135 SkMatrix* fMatrix;
137 enum Flags { 136 enum Flags {
138 kSave_Flag = 0x1, 137 kSave_Flag = 0x1,
139 kSaveLayer_Flag = 0x2 138 kSaveLayer_Flag = 0x2
140 }; 139 };
141 }; 140 };
142 141
142 Node fRoot;
143 SkMatrix fRootMatrix;
144
143 typedef SkRefCnt INHERITED; 145 typedef SkRefCnt INHERITED;
144 }; 146 };
145 147
146 #endif 148 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureStateTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698