OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #ifndef SkPicturePlayback_DEFINED | 8 #ifndef SkPicturePlayback_DEFINED |
9 #define SkPicturePlayback_DEFINED | 9 #define SkPicturePlayback_DEFINED |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const int index = reader.readInt(); | 102 const int index = reader.readInt(); |
103 if (SkBitmapHeap::INVALID_SLOT == index) { | 103 if (SkBitmapHeap::INVALID_SLOT == index) { |
104 #ifdef SK_DEBUG | 104 #ifdef SK_DEBUG |
105 SkDebugf("An invalid bitmap was recorded!\n"); | 105 SkDebugf("An invalid bitmap was recorded!\n"); |
106 #endif | 106 #endif |
107 return fBadBitmap; | 107 return fBadBitmap; |
108 } | 108 } |
109 return (*fBitmaps)[index]; | 109 return (*fBitmaps)[index]; |
110 } | 110 } |
111 | 111 |
112 const SkMatrix* getMatrix(SkReader32& reader) { | 112 void getMatrix(SkReader32& reader, SkMatrix* matrix) { |
113 int index = reader.readInt(); | 113 reader.readMatrix(matrix); |
114 if (index == 0) { | |
115 return NULL; | |
116 } | |
117 return &(*fMatrices)[index - 1]; | |
118 } | 114 } |
119 | 115 |
120 const SkPath& getPath(SkReader32& reader) { | 116 const SkPath& getPath(SkReader32& reader) { |
121 return (*fPathHeap)[reader.readInt() - 1]; | 117 return (*fPathHeap)[reader.readInt() - 1]; |
122 } | 118 } |
123 | 119 |
124 SkPicture& getPicture(SkReader32& reader) { | 120 SkPicture& getPicture(SkReader32& reader) { |
125 int index = reader.readInt(); | 121 int index = reader.readInt(); |
126 SkASSERT(index > 0 && index <= fPictureCount); | 122 SkASSERT(index > 0 && index <= fPictureCount); |
127 return *fPictureRefs[index - 1]; | 123 return *fPictureRefs[index - 1]; |
(...skipping 16 matching lines...) Expand all Loading... |
144 } | 140 } |
145 | 141 |
146 const SkIRect* getIRectPtr(SkReader32& reader) { | 142 const SkIRect* getIRectPtr(SkReader32& reader) { |
147 if (reader.readBool()) { | 143 if (reader.readBool()) { |
148 return &reader.skipT<SkIRect>(); | 144 return &reader.skipT<SkIRect>(); |
149 } else { | 145 } else { |
150 return NULL; | 146 return NULL; |
151 } | 147 } |
152 } | 148 } |
153 | 149 |
154 const SkRegion& getRegion(SkReader32& reader) { | 150 void getRegion(SkReader32& reader, SkRegion* region) { |
155 int index = reader.readInt(); | 151 reader.readRegion(region); |
156 return (*fRegions)[index - 1]; | |
157 } | 152 } |
158 | 153 |
159 void getText(SkReader32& reader, TextContainer* text) { | 154 void getText(SkReader32& reader, TextContainer* text) { |
160 size_t length = text->fByteLength = reader.readInt(); | 155 size_t length = text->fByteLength = reader.readInt(); |
161 text->fText = (const char*)reader.skip(length); | 156 text->fText = (const char*)reader.skip(length); |
162 } | 157 } |
163 | 158 |
164 void init(); | 159 void init(); |
165 | 160 |
166 #ifdef SK_DEBUG_SIZE | 161 #ifdef SK_DEBUG_SIZE |
167 public: | 162 public: |
168 int size(size_t* sizePtr); | 163 int size(size_t* sizePtr); |
169 int bitmaps(size_t* size); | 164 int bitmaps(size_t* size); |
170 int paints(size_t* size); | 165 int paints(size_t* size); |
171 int paths(size_t* size); | 166 int paths(size_t* size); |
172 int regions(size_t* size); | |
173 #endif | 167 #endif |
174 | 168 |
175 #ifdef SK_DEBUG_DUMP | 169 #ifdef SK_DEBUG_DUMP |
176 private: | 170 private: |
177 void dumpBitmap(const SkBitmap& bitmap) const; | 171 void dumpBitmap(const SkBitmap& bitmap) const; |
178 void dumpMatrix(const SkMatrix& matrix) const; | 172 void dumpMatrix(const SkMatrix& matrix) const; |
179 void dumpPaint(const SkPaint& paint) const; | 173 void dumpPaint(const SkPaint& paint) const; |
180 void dumpPath(const SkPath& path) const; | 174 void dumpPath(const SkPath& path) const; |
181 void dumpPicture(const SkPicture& picture) const; | 175 void dumpPicture(const SkPicture& picture) const; |
182 void dumpRegion(const SkRegion& region) const; | 176 void dumpRegion(const SkRegion& region) const; |
(...skipping 20 matching lines...) Expand all Loading... |
203 | 197 |
204 private: | 198 private: |
205 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty | 199 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty |
206 // bitmap allows playback to draw nothing and move on. | 200 // bitmap allows playback to draw nothing and move on. |
207 SkBitmap fBadBitmap; | 201 SkBitmap fBadBitmap; |
208 | 202 |
209 SkAutoTUnref<SkBitmapHeap> fBitmapHeap; | 203 SkAutoTUnref<SkBitmapHeap> fBitmapHeap; |
210 SkAutoTUnref<SkPathHeap> fPathHeap; | 204 SkAutoTUnref<SkPathHeap> fPathHeap; |
211 | 205 |
212 SkTRefArray<SkBitmap>* fBitmaps; | 206 SkTRefArray<SkBitmap>* fBitmaps; |
213 SkTRefArray<SkMatrix>* fMatrices; | |
214 SkTRefArray<SkPaint>* fPaints; | 207 SkTRefArray<SkPaint>* fPaints; |
215 SkTRefArray<SkRegion>* fRegions; | |
216 | 208 |
217 SkData* fOpData; // opcodes and parameters | 209 SkData* fOpData; // opcodes and parameters |
218 | 210 |
219 SkPicture** fPictureRefs; | 211 SkPicture** fPictureRefs; |
220 int fPictureCount; | 212 int fPictureCount; |
221 | 213 |
222 SkBBoxHierarchy* fBoundingHierarchy; | 214 SkBBoxHierarchy* fBoundingHierarchy; |
223 SkPictureStateTree* fStateTree; | 215 SkPictureStateTree* fStateTree; |
224 | 216 |
225 SkTypefacePlayback fTFPlayback; | 217 SkTypefacePlayback fTFPlayback; |
226 SkFactoryPlayback* fFactoryPlayback; | 218 SkFactoryPlayback* fFactoryPlayback; |
227 #ifdef SK_BUILD_FOR_ANDROID | 219 #ifdef SK_BUILD_FOR_ANDROID |
228 SkMutex fDrawMutex; | 220 SkMutex fDrawMutex; |
229 bool fAbortCurrentPlayback; | 221 bool fAbortCurrentPlayback; |
230 #endif | 222 #endif |
231 }; | 223 }; |
232 | 224 |
233 #endif | 225 #endif |
OLD | NEW |