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

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

Issue 214413008: Thread picture version through to SkReadBuffer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: debugger too Created 6 years, 8 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
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/core/SkPicturePlayback.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 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 struct SkPictCopyInfo { 69 struct SkPictCopyInfo {
70 SkPictCopyInfo() : initialized(false), controller(1024) {} 70 SkPictCopyInfo() : initialized(false), controller(1024) {}
71 71
72 bool initialized; 72 bool initialized;
73 SkChunkFlatController controller; 73 SkChunkFlatController controller;
74 SkTDArray<SkFlatData*> paintData; 74 SkTDArray<SkFlatData*> paintData;
75 }; 75 };
76 76
77 class SkPicturePlayback { 77 class SkPicturePlayback {
78 public: 78 public:
79 SkPicturePlayback();
80 SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo = NULL); 79 SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo = NULL);
81 explicit SkPicturePlayback(const SkPictureRecord& record, bool deepCopy = fa lse); 80 SkPicturePlayback(const SkPictureRecord& record, const SkPictInfo&, bool dee pCopy = false);
82 static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&, 81 static SkPicturePlayback* CreateFromStream(SkStream*,
82 const SkPictInfo&,
83 SkPicture::InstallPixelRefProc); 83 SkPicture::InstallPixelRefProc);
84 static SkPicturePlayback* CreateFromBuffer(SkReadBuffer&); 84 static SkPicturePlayback* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&) ;
85 85
86 virtual ~SkPicturePlayback(); 86 virtual ~SkPicturePlayback();
87 87
88 const SkPicture::OperationList& getActiveOps(const SkIRect& queryRect); 88 const SkPicture::OperationList& getActiveOps(const SkIRect& queryRect);
89 89
90 void draw(SkCanvas& canvas, SkDrawPictureCallback*); 90 void draw(SkCanvas& canvas, SkDrawPictureCallback*);
91 91
92 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; 92 void serialize(SkWStream*, SkPicture::EncodeBitmap) const;
93 void flatten(SkWriteBuffer&) const; 93 void flatten(SkWriteBuffer&) const;
94 94
95 void dumpSize() const; 95 void dumpSize() const;
96 96
97 bool containsBitmaps() const; 97 bool containsBitmaps() const;
98 98
99 #ifdef SK_BUILD_FOR_ANDROID 99 #ifdef SK_BUILD_FOR_ANDROID
100 // Can be called in the middle of playback (the draw() call). WIll abort the 100 // Can be called in the middle of playback (the draw() call). WIll abort the
101 // drawing and return from draw() after the "current" op code is done 101 // drawing and return from draw() after the "current" op code is done
102 void abort() { fAbortCurrentPlayback = true; } 102 void abort() { fAbortCurrentPlayback = true; }
103 #endif 103 #endif
104 104
105 size_t curOpID() const { return fCurOffset; } 105 size_t curOpID() const { return fCurOffset; }
106 void resetOpID() { fCurOffset = 0; } 106 void resetOpID() { fCurOffset = 0; }
107 107
108 protected: 108 protected:
109 bool parseStream(SkStream*, const SkPictInfo&, 109 explicit SkPicturePlayback(const SkPictInfo& info);
110 SkPicture::InstallPixelRefProc); 110
111 bool parseStream(SkStream*, SkPicture::InstallPixelRefProc);
111 bool parseBuffer(SkReadBuffer& buffer); 112 bool parseBuffer(SkReadBuffer& buffer);
112 #ifdef SK_DEVELOPER 113 #ifdef SK_DEVELOPER
113 virtual bool preDraw(int opIndex, int type); 114 virtual bool preDraw(int opIndex, int type);
114 virtual void postDraw(int opIndex); 115 virtual void postDraw(int opIndex);
115 #endif 116 #endif
116 117
117 void preLoadBitmaps(const SkTDArray<void*>* results); 118 void preLoadBitmaps(const SkTDArray<void*>* results);
118 119
119 private: 120 private:
120 class TextContainer { 121 class TextContainer {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 int dumpRectPtr(char* bufferPtr, char* buffer, char* name); 211 int dumpRectPtr(char* bufferPtr, char* buffer, char* name);
211 int dumpScalar(char* bufferPtr, char* buffer, char* name); 212 int dumpScalar(char* bufferPtr, char* buffer, char* name);
212 void dumpText(char** bufferPtrPtr, char* buffer); 213 void dumpText(char** bufferPtrPtr, char* buffer);
213 void dumpStream(); 214 void dumpStream();
214 215
215 public: 216 public:
216 void dump() const; 217 void dump() const;
217 #endif 218 #endif
218 219
219 private: // these help us with reading/writing 220 private: // these help us with reading/writing
220 bool parseStreamTag(SkStream*, const SkPictInfo&, uint32_t tag, size_t size, 221 bool parseStreamTag(SkStream*, uint32_t tag, size_t size, SkPicture::Install PixelRefProc);
221 SkPicture::InstallPixelRefProc);
222 bool parseBufferTag(SkReadBuffer&, uint32_t tag, size_t size); 222 bool parseBufferTag(SkReadBuffer&, uint32_t tag, size_t size);
223 void flattenToBuffer(SkWriteBuffer&) const; 223 void flattenToBuffer(SkWriteBuffer&) const;
224 224
225 private: 225 private:
226 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_ SLOT. This empty 226 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_ SLOT. This empty
227 // bitmap allows playback to draw nothing and move on. 227 // bitmap allows playback to draw nothing and move on.
228 SkBitmap fBadBitmap; 228 SkBitmap fBadBitmap;
229 229
230 SkAutoTUnref<SkBitmapHeap> fBitmapHeap; 230 SkAutoTUnref<SkBitmapHeap> fBitmapHeap;
231 SkAutoTUnref<SkPathHeap> fPathHeap; 231 SkAutoTUnref<SkPathHeap> fPathHeap;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 }; 264 };
265 265
266 CachedOperationList* fCachedActiveOps; 266 CachedOperationList* fCachedActiveOps;
267 267
268 SkTypefacePlayback fTFPlayback; 268 SkTypefacePlayback fTFPlayback;
269 SkFactoryPlayback* fFactoryPlayback; 269 SkFactoryPlayback* fFactoryPlayback;
270 270
271 // The offset of the current operation when within the draw method 271 // The offset of the current operation when within the draw method
272 size_t fCurOffset; 272 size_t fCurOffset;
273 273
274 const SkPictInfo fInfo;
275
274 #ifdef SK_BUILD_FOR_ANDROID 276 #ifdef SK_BUILD_FOR_ANDROID
275 SkMutex fDrawMutex; 277 SkMutex fDrawMutex;
276 bool fAbortCurrentPlayback; 278 bool fAbortCurrentPlayback;
277 #endif 279 #endif
278 }; 280 };
279 281
280 #endif 282 #endif
OLDNEW
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698