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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(SkReadBuffer&); | |
68 | 67 |
69 virtual ~SkPicturePlayback(); | 68 virtual ~SkPicturePlayback(); |
70 | 69 |
71 void draw(SkCanvas& canvas, SkDrawPictureCallback*); | 70 void draw(SkCanvas& canvas, SkDrawPictureCallback*); |
72 | 71 |
73 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; | 72 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; |
74 void flatten(SkWriteBuffer&) const; | |
75 | 73 |
76 void dumpSize() const; | 74 void dumpSize() const; |
77 | 75 |
78 bool containsBitmaps() const; | 76 bool containsBitmaps() const; |
79 | 77 |
80 #ifdef SK_BUILD_FOR_ANDROID | 78 #ifdef SK_BUILD_FOR_ANDROID |
81 // Can be called in the middle of playback (the draw() call). WIll abort the | 79 // Can be called in the middle of playback (the draw() call). WIll abort the |
82 // drawing and return from draw() after the "current" op code is done | 80 // drawing and return from draw() after the "current" op code is done |
83 void abort() { fAbortCurrentPlayback = true; } | 81 void abort() { fAbortCurrentPlayback = true; } |
84 #endif | 82 #endif |
85 | 83 |
86 protected: | 84 protected: |
87 bool parseStream(SkStream*, const SkPictInfo&, | 85 bool parseStream(SkStream*, const SkPictInfo&, |
88 SkPicture::InstallPixelRefProc); | 86 SkPicture::InstallPixelRefProc); |
89 bool parseBuffer(SkReadBuffer& buffer); | |
90 #ifdef SK_DEVELOPER | 87 #ifdef SK_DEVELOPER |
91 virtual bool preDraw(int opIndex, int type); | 88 virtual bool preDraw(int opIndex, int type); |
92 virtual void postDraw(int opIndex); | 89 virtual void postDraw(int opIndex); |
93 #endif | 90 #endif |
94 | 91 |
95 private: | 92 private: |
96 class TextContainer { | 93 class TextContainer { |
97 public: | 94 public: |
98 size_t length() { return fByteLength; } | 95 size_t length() { return fByteLength; } |
99 const void* text() { return (const void*) fText; } | 96 const void* text() { return (const void*) fText; } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 216 |
220 SkTypefacePlayback fTFPlayback; | 217 SkTypefacePlayback fTFPlayback; |
221 SkFactoryPlayback* fFactoryPlayback; | 218 SkFactoryPlayback* fFactoryPlayback; |
222 #ifdef SK_BUILD_FOR_ANDROID | 219 #ifdef SK_BUILD_FOR_ANDROID |
223 SkMutex fDrawMutex; | 220 SkMutex fDrawMutex; |
224 bool fAbortCurrentPlayback; | 221 bool fAbortCurrentPlayback; |
225 #endif | 222 #endif |
226 }; | 223 }; |
227 | 224 |
228 #endif | 225 #endif |
OLD | NEW |