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

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

Issue 138063005: Serialization of SkPictureImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 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
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 SkTDArray<SkFlatData*> paintData; 57 SkTDArray<SkFlatData*> paintData;
58 }; 58 };
59 59
60 class SkPicturePlayback { 60 class SkPicturePlayback {
61 public: 61 public:
62 SkPicturePlayback(); 62 SkPicturePlayback();
63 SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo = NULL); 63 SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo = NULL);
64 explicit SkPicturePlayback(const SkPictureRecord& record, bool deepCopy = fa lse); 64 explicit SkPicturePlayback(const SkPictureRecord& record, bool deepCopy = fa lse);
65 static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&, 65 static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&,
66 SkPicture::InstallPixelRefProc); 66 SkPicture::InstallPixelRefProc);
67 static SkPicturePlayback* CreateFromBuffer(SkFlattenableReadBuffer&);
67 68
68 virtual ~SkPicturePlayback(); 69 virtual ~SkPicturePlayback();
69 70
70 void draw(SkCanvas& canvas, SkDrawPictureCallback*); 71 void draw(SkCanvas& canvas, SkDrawPictureCallback*);
71 72
72 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; 73 void serialize(SkWStream*, SkPicture::EncodeBitmap) const;
74 void flatten(SkFlattenableWriteBuffer&) const;
73 75
74 void dumpSize() const; 76 void dumpSize() const;
75 77
76 bool containsBitmaps() const; 78 bool containsBitmaps() const;
77 79
78 #ifdef SK_BUILD_FOR_ANDROID 80 #ifdef SK_BUILD_FOR_ANDROID
79 // Can be called in the middle of playback (the draw() call). WIll abort the 81 // Can be called in the middle of playback (the draw() call). WIll abort the
80 // drawing and return from draw() after the "current" op code is done 82 // drawing and return from draw() after the "current" op code is done
81 void abort() { fAbortCurrentPlayback = true; } 83 void abort() { fAbortCurrentPlayback = true; }
82 #endif 84 #endif
83 85
84 protected: 86 protected:
85 bool parseStream(SkStream*, const SkPictInfo&, 87 bool parseStream(SkStream*, const SkPictInfo&,
86 SkPicture::InstallPixelRefProc); 88 SkPicture::InstallPixelRefProc);
89 bool parseBuffer(SkFlattenableReadBuffer& buffer);
87 #ifdef SK_DEVELOPER 90 #ifdef SK_DEVELOPER
88 virtual bool preDraw(int opIndex, int type); 91 virtual bool preDraw(int opIndex, int type);
89 virtual void postDraw(int opIndex); 92 virtual void postDraw(int opIndex);
90 #endif 93 #endif
91 94
92 private: 95 private:
93 class TextContainer { 96 class TextContainer {
94 public: 97 public:
95 size_t length() { return fByteLength; } 98 size_t length() { return fByteLength; }
96 const void* text() { return (const void*) fText; } 99 const void* text() { return (const void*) fText; }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 void dumpText(char** bufferPtrPtr, char* buffer); 194 void dumpText(char** bufferPtrPtr, char* buffer);
192 void dumpStream(); 195 void dumpStream();
193 196
194 public: 197 public:
195 void dump() const; 198 void dump() const;
196 #endif 199 #endif
197 200
198 private: // these help us with reading/writing 201 private: // these help us with reading/writing
199 bool parseStreamTag(SkStream*, const SkPictInfo&, uint32_t tag, size_t size, 202 bool parseStreamTag(SkStream*, const SkPictInfo&, uint32_t tag, size_t size,
200 SkPicture::InstallPixelRefProc); 203 SkPicture::InstallPixelRefProc);
201 bool parseBufferTag(SkOrderedReadBuffer&, uint32_t tag, size_t size); 204 bool parseBufferTag(SkFlattenableReadBuffer&, uint32_t tag, size_t size);
202 void flattenToBuffer(SkOrderedWriteBuffer&) const; 205 void flattenToBuffer(SkFlattenableWriteBuffer&) const;
203 206
204 private: 207 private:
205 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_ SLOT. This empty 208 // 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. 209 // bitmap allows playback to draw nothing and move on.
207 SkBitmap fBadBitmap; 210 SkBitmap fBadBitmap;
208 211
209 SkAutoTUnref<SkBitmapHeap> fBitmapHeap; 212 SkAutoTUnref<SkBitmapHeap> fBitmapHeap;
210 SkAutoTUnref<SkPathHeap> fPathHeap; 213 SkAutoTUnref<SkPathHeap> fPathHeap;
211 214
212 SkTRefArray<SkBitmap>* fBitmaps; 215 SkTRefArray<SkBitmap>* fBitmaps;
(...skipping 11 matching lines...) Expand all
224 227
225 SkTypefacePlayback fTFPlayback; 228 SkTypefacePlayback fTFPlayback;
226 SkFactoryPlayback* fFactoryPlayback; 229 SkFactoryPlayback* fFactoryPlayback;
227 #ifdef SK_BUILD_FOR_ANDROID 230 #ifdef SK_BUILD_FOR_ANDROID
228 SkMutex fDrawMutex; 231 SkMutex fDrawMutex;
229 bool fAbortCurrentPlayback; 232 bool fAbortCurrentPlayback;
230 #endif 233 #endif
231 }; 234 };
232 235
233 #endif 236 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698