| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 public: | 78 public: |
| 79 SkPicturePlayback(); | 79 SkPicturePlayback(); |
| 80 SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo
= NULL); | 80 SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo
= NULL); |
| 81 explicit SkPicturePlayback(const SkPictureRecord& record, bool deepCopy = fa
lse); | 81 explicit SkPicturePlayback(const SkPictureRecord& record, bool deepCopy = fa
lse); |
| 82 static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&, | 82 static SkPicturePlayback* CreateFromStream(SkStream*, const SkPictInfo&, |
| 83 SkPicture::InstallPixelRefProc); | 83 SkPicture::InstallPixelRefProc); |
| 84 static SkPicturePlayback* CreateFromBuffer(SkReadBuffer&); | 84 static SkPicturePlayback* CreateFromBuffer(SkReadBuffer&); |
| 85 | 85 |
| 86 virtual ~SkPicturePlayback(); | 86 virtual ~SkPicturePlayback(); |
| 87 | 87 |
| 88 const SkPicture::OperationList& getActiveOps(const SkIRect& queryRect); | |
| 89 | |
| 90 void draw(SkCanvas& canvas, SkDrawPictureCallback*); | 88 void draw(SkCanvas& canvas, SkDrawPictureCallback*); |
| 91 | 89 |
| 92 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; | 90 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; |
| 93 void flatten(SkWriteBuffer&) const; | 91 void flatten(SkWriteBuffer&) const; |
| 94 | 92 |
| 95 void dumpSize() const; | 93 void dumpSize() const; |
| 96 | 94 |
| 97 bool containsBitmaps() const; | 95 bool containsBitmaps() const; |
| 98 | 96 |
| 99 #ifdef SK_BUILD_FOR_ANDROID | 97 #ifdef SK_BUILD_FOR_ANDROID |
| 100 // Can be called in the middle of playback (the draw() call). WIll abort the | 98 // 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 | 99 // drawing and return from draw() after the "current" op code is done |
| 102 void abort() { fAbortCurrentPlayback = true; } | 100 void abort() { fAbortCurrentPlayback = true; } |
| 103 #endif | 101 #endif |
| 104 | 102 |
| 105 protected: | 103 protected: |
| 106 bool parseStream(SkStream*, const SkPictInfo&, | 104 bool parseStream(SkStream*, const SkPictInfo&, |
| 107 SkPicture::InstallPixelRefProc); | 105 SkPicture::InstallPixelRefProc); |
| 108 bool parseBuffer(SkReadBuffer& buffer); | 106 bool parseBuffer(SkReadBuffer& buffer); |
| 109 #ifdef SK_DEVELOPER | 107 #ifdef SK_DEVELOPER |
| 110 virtual bool preDraw(int opIndex, int type); | 108 virtual bool preDraw(int opIndex, int type); |
| 111 virtual void postDraw(int opIndex); | 109 virtual void postDraw(int opIndex); |
| 112 #endif | 110 #endif |
| 113 | 111 |
| 114 void preLoadBitmaps(const SkTDArray<void*>* results); | 112 void preLoadBitmaps(const SkTDArray<void*>& results); |
| 115 | 113 |
| 116 private: | 114 private: |
| 117 class TextContainer { | 115 class TextContainer { |
| 118 public: | 116 public: |
| 119 size_t length() { return fByteLength; } | 117 size_t length() { return fByteLength; } |
| 120 const void* text() { return (const void*) fText; } | 118 const void* text() { return (const void*) fText; } |
| 121 size_t fByteLength; | 119 size_t fByteLength; |
| 122 const char* fText; | 120 const char* fText; |
| 123 }; | 121 }; |
| 124 | 122 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 230 |
| 233 SkData* fOpData; // opcodes and parameters | 231 SkData* fOpData; // opcodes and parameters |
| 234 SkAutoTUnref<SkOffsetTable> fBitmapUseOffsets; | 232 SkAutoTUnref<SkOffsetTable> fBitmapUseOffsets; |
| 235 | 233 |
| 236 SkPicture** fPictureRefs; | 234 SkPicture** fPictureRefs; |
| 237 int fPictureCount; | 235 int fPictureCount; |
| 238 | 236 |
| 239 SkBBoxHierarchy* fBoundingHierarchy; | 237 SkBBoxHierarchy* fBoundingHierarchy; |
| 240 SkPictureStateTree* fStateTree; | 238 SkPictureStateTree* fStateTree; |
| 241 | 239 |
| 242 class CachedOperationList : public SkPicture::OperationList { | |
| 243 public: | |
| 244 CachedOperationList() { | |
| 245 fCacheQueryRect.setEmpty(); | |
| 246 } | |
| 247 | |
| 248 virtual bool valid() const { return true; } | |
| 249 virtual int numOps() const SK_OVERRIDE { return fOps.count(); } | |
| 250 virtual uint32_t offset(int index) const SK_OVERRIDE; | |
| 251 virtual const SkMatrix& matrix(int index) const SK_OVERRIDE; | |
| 252 | |
| 253 // The query rect for which the cached active ops are valid | |
| 254 SkIRect fCacheQueryRect; | |
| 255 | |
| 256 // The operations which are active within 'fCachedQueryRect' | |
| 257 SkTDArray<void*> fOps; | |
| 258 | |
| 259 private: | |
| 260 typedef SkPicture::OperationList INHERITED; | |
| 261 }; | |
| 262 | |
| 263 CachedOperationList* fCachedActiveOps; | |
| 264 | |
| 265 SkTypefacePlayback fTFPlayback; | 240 SkTypefacePlayback fTFPlayback; |
| 266 SkFactoryPlayback* fFactoryPlayback; | 241 SkFactoryPlayback* fFactoryPlayback; |
| 267 #ifdef SK_BUILD_FOR_ANDROID | 242 #ifdef SK_BUILD_FOR_ANDROID |
| 268 SkMutex fDrawMutex; | 243 SkMutex fDrawMutex; |
| 269 bool fAbortCurrentPlayback; | 244 bool fAbortCurrentPlayback; |
| 270 #endif | 245 #endif |
| 271 }; | 246 }; |
| 272 | 247 |
| 273 #endif | 248 #endif |
| OLD | NEW |