OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkPictureData_DEFINED | 8 #ifndef SkPictureData_DEFINED |
9 #define SkPictureData_DEFINED | 9 #define SkPictureData_DEFINED |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 bool containsBitmaps() const; | 153 bool containsBitmaps() const; |
154 | 154 |
155 protected: | 155 protected: |
156 explicit SkPictureData(const SkPictInfo& info); | 156 explicit SkPictureData(const SkPictInfo& info); |
157 | 157 |
158 bool parseStream(SkStream*, SkPicture::InstallPixelRefProc); | 158 bool parseStream(SkStream*, SkPicture::InstallPixelRefProc); |
159 bool parseBuffer(SkReadBuffer& buffer); | 159 bool parseBuffer(SkReadBuffer& buffer); |
160 | 160 |
161 private: | 161 private: |
162 | 162 |
163 const SkBitmap& getBitmap(SkReader32& reader) const { | 163 const SkBitmap& getBitmap(SkReader32* reader) const { |
164 const int index = reader.readInt(); | 164 const int index = reader->readInt(); |
165 if (SkBitmapHeap::INVALID_SLOT == index) { | 165 if (SkBitmapHeap::INVALID_SLOT == index) { |
166 #ifdef SK_DEBUG | 166 #ifdef SK_DEBUG |
167 SkDebugf("An invalid bitmap was recorded!\n"); | 167 SkDebugf("An invalid bitmap was recorded!\n"); |
168 #endif | 168 #endif |
169 return fBadBitmap; | 169 return fBadBitmap; |
170 } | 170 } |
171 return (*fBitmaps)[index]; | 171 return (*fBitmaps)[index]; |
172 } | 172 } |
173 | 173 |
174 const SkPath& getPath(SkReader32& reader) const { | 174 const SkPath& getPath(SkReader32* reader) const { |
175 int index = reader.readInt() - 1; | 175 int index = reader->readInt() - 1; |
176 return (*fPathHeap.get())[index]; | 176 return (*fPathHeap.get())[index]; |
177 } | 177 } |
178 | 178 |
179 const SkPicture* getPicture(SkReader32& reader) const { | 179 const SkPicture* getPicture(SkReader32* reader) const { |
180 int index = reader.readInt(); | 180 int index = reader->readInt(); |
181 SkASSERT(index > 0 && index <= fPictureCount); | 181 SkASSERT(index > 0 && index <= fPictureCount); |
182 return fPictureRefs[index - 1]; | 182 return fPictureRefs[index - 1]; |
183 } | 183 } |
184 | 184 |
185 const SkPaint* getPaint(SkReader32& reader) const { | 185 const SkPaint* getPaint(SkReader32* reader) const { |
186 int index = reader.readInt(); | 186 int index = reader->readInt(); |
187 if (index == 0) { | 187 if (index == 0) { |
188 return NULL; | 188 return NULL; |
189 } | 189 } |
190 return &(*fPaints)[index - 1]; | 190 return &(*fPaints)[index - 1]; |
191 } | 191 } |
192 | 192 |
193 void init(); | 193 void init(); |
194 | 194 |
195 #ifdef SK_DEBUG_SIZE | 195 #ifdef SK_DEBUG_SIZE |
196 public: | 196 public: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 SkAutoTUnref<const SkPathHeap> fPathHeap; // reference counted | 262 SkAutoTUnref<const SkPathHeap> fPathHeap; // reference counted |
263 | 263 |
264 const SkPicture** fPictureRefs; | 264 const SkPicture** fPictureRefs; |
265 int fPictureCount; | 265 int fPictureCount; |
266 | 266 |
267 SkBBoxHierarchy* fBoundingHierarchy; | 267 SkBBoxHierarchy* fBoundingHierarchy; |
268 SkPictureStateTree* fStateTree; | 268 SkPictureStateTree* fStateTree; |
269 | 269 |
270 SkPictureContentInfo fContentInfo; | 270 SkPictureContentInfo fContentInfo; |
271 | 271 |
272 class OperationList : public SkPicture::OperationList { | |
273 public: | |
274 OperationList() { } | |
275 virtual int numOps() const SK_OVERRIDE { return fOps.count(); } | |
276 virtual uint32_t offset(int index) const SK_OVERRIDE; | |
277 virtual const SkMatrix& matrix(int index) const SK_OVERRIDE; | |
278 | |
279 // The operations which are active within 'fCachedQueryRect' | |
280 SkTDArray<void*> fOps; | |
281 | |
282 private: | |
283 typedef SkPicture::OperationList INHERITED; | |
284 }; | |
285 | |
286 SkTypefacePlayback fTFPlayback; | 272 SkTypefacePlayback fTFPlayback; |
287 SkFactoryPlayback* fFactoryPlayback; | 273 SkFactoryPlayback* fFactoryPlayback; |
288 | 274 |
289 const SkPictInfo fInfo; | 275 const SkPictInfo fInfo; |
290 | 276 |
291 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); | 277 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); |
292 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); | 278 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); |
293 | 279 |
294 void initForPlayback() const; | 280 void initForPlayback() const; |
295 }; | 281 }; |
296 | 282 |
297 #endif | 283 #endif |
OLD | NEW |