| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 bool initialized; | 55 bool initialized; |
| 56 SkChunkFlatController controller; | 56 SkChunkFlatController controller; |
| 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 SkPicturePlayback(SkStream*, const SkPictInfo&, SkPicture::InstallPixelRefPr
oc); | 65 static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&, |
| 66 SkPicture::InstallPixelRefProc); |
| 66 | 67 |
| 67 virtual ~SkPicturePlayback(); | 68 virtual ~SkPicturePlayback(); |
| 68 | 69 |
| 69 void draw(SkCanvas& canvas, SkDrawPictureCallback*); | 70 void draw(SkCanvas& canvas, SkDrawPictureCallback*); |
| 70 | 71 |
| 71 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; | 72 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; |
| 72 | 73 |
| 73 void dumpSize() const; | 74 void dumpSize() const; |
| 74 | 75 |
| 75 #ifdef SK_BUILD_FOR_ANDROID | 76 #ifdef SK_BUILD_FOR_ANDROID |
| 76 // Can be called in the middle of playback (the draw() call). WIll abort the | 77 // Can be called in the middle of playback (the draw() call). WIll abort the |
| 77 // drawing and return from draw() after the "current" op code is done | 78 // drawing and return from draw() after the "current" op code is done |
| 78 void abort() { fAbortCurrentPlayback = true; } | 79 void abort() { fAbortCurrentPlayback = true; } |
| 79 #endif | 80 #endif |
| 80 | 81 |
| 81 protected: | 82 protected: |
| 83 bool parseStream(SkStream*, const SkPictInfo&, |
| 84 SkPicture::InstallPixelRefProc); |
| 82 #ifdef SK_DEVELOPER | 85 #ifdef SK_DEVELOPER |
| 83 virtual bool preDraw(int opIndex, int type); | 86 virtual bool preDraw(int opIndex, int type); |
| 84 virtual void postDraw(int opIndex); | 87 virtual void postDraw(int opIndex); |
| 85 #endif | 88 #endif |
| 86 | 89 |
| 87 private: | 90 private: |
| 88 class TextContainer { | 91 class TextContainer { |
| 89 public: | 92 public: |
| 90 size_t length() { return fByteLength; } | 93 size_t length() { return fByteLength; } |
| 91 const void* text() { return (const void*) fText; } | 94 const void* text() { return (const void*) fText; } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 int dumpRectPtr(char* bufferPtr, char* buffer, char* name); | 187 int dumpRectPtr(char* bufferPtr, char* buffer, char* name); |
| 185 int dumpScalar(char* bufferPtr, char* buffer, char* name); | 188 int dumpScalar(char* bufferPtr, char* buffer, char* name); |
| 186 void dumpText(char** bufferPtrPtr, char* buffer); | 189 void dumpText(char** bufferPtrPtr, char* buffer); |
| 187 void dumpStream(); | 190 void dumpStream(); |
| 188 | 191 |
| 189 public: | 192 public: |
| 190 void dump() const; | 193 void dump() const; |
| 191 #endif | 194 #endif |
| 192 | 195 |
| 193 private: // these help us with reading/writing | 196 private: // these help us with reading/writing |
| 194 void parseStreamTag(SkStream*, const SkPictInfo&, uint32_t tag, size_t size, | 197 bool parseStreamTag(SkStream*, const SkPictInfo&, uint32_t tag, size_t size, |
| 195 SkPicture::InstallPixelRefProc); | 198 SkPicture::InstallPixelRefProc); |
| 196 void parseBufferTag(SkOrderedReadBuffer&, uint32_t tag, size_t size); | 199 bool parseBufferTag(SkOrderedReadBuffer&, uint32_t tag, size_t size); |
| 197 void flattenToBuffer(SkOrderedWriteBuffer&) const; | 200 void flattenToBuffer(SkOrderedWriteBuffer&) const; |
| 198 | 201 |
| 199 private: | 202 private: |
| 200 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty | 203 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty |
| 201 // bitmap allows playback to draw nothing and move on. | 204 // bitmap allows playback to draw nothing and move on. |
| 202 SkBitmap fBadBitmap; | 205 SkBitmap fBadBitmap; |
| 203 | 206 |
| 204 SkAutoTUnref<SkBitmapHeap> fBitmapHeap; | 207 SkAutoTUnref<SkBitmapHeap> fBitmapHeap; |
| 205 SkAutoTUnref<SkPathHeap> fPathHeap; | 208 SkAutoTUnref<SkPathHeap> fPathHeap; |
| 206 | 209 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 219 | 222 |
| 220 SkTypefacePlayback fTFPlayback; | 223 SkTypefacePlayback fTFPlayback; |
| 221 SkFactoryPlayback* fFactoryPlayback; | 224 SkFactoryPlayback* fFactoryPlayback; |
| 222 #ifdef SK_BUILD_FOR_ANDROID | 225 #ifdef SK_BUILD_FOR_ANDROID |
| 223 SkMutex fDrawMutex; | 226 SkMutex fDrawMutex; |
| 224 bool fAbortCurrentPlayback; | 227 bool fAbortCurrentPlayback; |
| 225 #endif | 228 #endif |
| 226 }; | 229 }; |
| 227 | 230 |
| 228 #endif | 231 #endif |
| OLD | NEW |