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

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

Issue 261663003: First pass at pre-rendering saveLayers for GPU (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Reduce size of PlaybackReplacements in SkPicturePlayback.h Created 6 years, 7 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
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 * a save or saveLayer that was removed from the command stream 67 * a save or saveLayer that was removed from the command stream
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 op offset needed to create the drawing state
78 required by the queued up draw operation or the offset of the queued
79 up draw operation itself. In the latter case, the next draw operatio n
80 will move into the queued up slot.
81 It retuns kDrawComplete when done.
82 TODO: this might be better named nextOp
83 */
78 uint32_t nextDraw(); 84 uint32_t nextDraw();
85 /** Peek at the currently queued up draw op's offset. Note that this can
86 be different then what 'nextDraw' would return b.c. it is
87 the offset of the next _draw_ op while 'nextDraw' can return
88 the offsets to saveLayer and clip ops while it is creating the prope r
89 drawing context for the queued up draw op.
90 */
91 uint32_t peekDraw();
92 /** Stop trying to create the drawing context for the currently queued
93 up _draw_ operation and queue up the next one. This call returns
94 the offset of the skipped _draw_ operation. Obviously (since the
95 correct drawing context has not been established), the skipped
96 _draw_ operation should not be issued. Returns kDrawComplete if
97 the end of the draw operations is reached.
98 */
99 uint32_t skipDraw();
79 static const uint32_t kDrawComplete = SK_MaxU32; 100 static const uint32_t kDrawComplete = SK_MaxU32;
80 Iterator() : fPlaybackMatrix(), fValid(false) { } 101 Iterator() : fPlaybackMatrix(), fValid(false) { }
81 bool isValid() const { return fValid; } 102 bool isValid() const { return fValid; }
82 103
83 private: 104 private:
84 Iterator(const SkTDArray<void*>& draws, SkCanvas* canvas, Node* root); 105 Iterator(const SkTDArray<void*>& draws, SkCanvas* canvas, Node* root);
85 106
86 void setCurrentMatrix(const SkMatrix*); 107 void setCurrentMatrix(const SkMatrix*);
87 108
88 // The draws this iterator is associated with 109 // The draws this iterator is associated with
(...skipping 15 matching lines...) Expand all
104 const SkMatrix* fCurrentMatrix; 125 const SkMatrix* fCurrentMatrix;
105 126
106 // current position in the array of draws 127 // current position in the array of draws
107 int fPlaybackIndex; 128 int fPlaybackIndex;
108 // Whether or not we need to do a save next iteration 129 // Whether or not we need to do a save next iteration
109 bool fSave; 130 bool fSave;
110 131
111 // Whether or not this is a valid iterator (the default public construct or sets this false) 132 // Whether or not this is a valid iterator (the default public construct or sets this false)
112 bool fValid; 133 bool fValid;
113 134
135 uint32_t finish();
136
114 friend class SkPictureStateTree; 137 friend class SkPictureStateTree;
115 }; 138 };
116 139
117 private: 140 private:
118 141
119 void appendNode(size_t offset); 142 void appendNode(size_t offset);
120 143
121 SkChunkAlloc fAlloc; 144 SkChunkAlloc fAlloc;
122 // Needed by saveCollapsed() because nodes do not currently store 145 // Needed by saveCollapsed() because nodes do not currently store
123 // references to their children. If they did, we could just retrieve the 146 // references to their children. If they did, we could just retrieve the
(...skipping 19 matching lines...) Expand all
143 }; 166 };
144 }; 167 };
145 168
146 Node fRoot; 169 Node fRoot;
147 SkMatrix fRootMatrix; 170 SkMatrix fRootMatrix;
148 171
149 typedef SkRefCnt INHERITED; 172 typedef SkRefCnt INHERITED;
150 }; 173 };
151 174
152 #endif 175 #endif
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | src/core/SkPictureStateTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698