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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 SkPicturePlayback(const SkPictureRecord& record, const SkPictInfo&, bool dee
pCopy = false); | 80 SkPicturePlayback(const SkPictureRecord& record, const SkPictInfo&, bool dee
pCopy = false); |
81 static SkPicturePlayback* CreateFromStream(SkStream*, | 81 static SkPicturePlayback* CreateFromStream(SkStream*, |
82 const SkPictInfo&, | 82 const SkPictInfo&, |
83 SkPicture::InstallPixelRefProc); | 83 SkPicture::InstallPixelRefProc); |
84 static SkPicturePlayback* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&)
; | 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 struct Foo { |
| 91 public: |
| 92 size_t fStart; |
| 93 size_t fStop; |
| 94 SkIPoint fPos; |
| 95 SkBitmap* fBM; |
| 96 const SkPaint* fPaint; |
| 97 }; |
| 98 |
| 99 class Bar { |
| 100 public: |
| 101 ~Bar() { |
| 102 this->freeAll(); |
| 103 } |
| 104 |
| 105 Foo* lookupStart(size_t start); |
| 106 Foo* lookupStop(size_t stop); |
| 107 Foo* push() { |
| 108 return fFoo.push(); |
| 109 } |
| 110 |
| 111 void freeAll() { |
| 112 for (int i = 0; i < fFoo.count(); ++i) { |
| 113 SkDELETE(fFoo[i].fBM); |
| 114 fFoo[i].fBM = NULL; |
| 115 } |
| 116 } |
| 117 |
| 118 private: |
| 119 SkTDArray<Foo> fFoo; |
| 120 }; |
| 121 |
| 122 void draw(SkCanvas& canvas, int start, int stop, SkDrawPictureCallback*, Bar
* bar); |
91 | 123 |
92 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; | 124 void serialize(SkWStream*, SkPicture::EncodeBitmap) const; |
93 void flatten(SkWriteBuffer&) const; | 125 void flatten(SkWriteBuffer&) const; |
94 | 126 |
95 void dumpSize() const; | 127 void dumpSize() const; |
96 | 128 |
97 bool containsBitmaps() const; | 129 bool containsBitmaps() const; |
98 | 130 |
99 #ifdef SK_BUILD_FOR_ANDROID | 131 #ifdef SK_BUILD_FOR_ANDROID |
100 // Can be called in the middle of playback (the draw() call). WIll abort the | 132 // Can be called in the middle of playback (the draw() call). WIll abort the |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 305 |
274 const SkPictInfo fInfo; | 306 const SkPictInfo fInfo; |
275 | 307 |
276 #ifdef SK_BUILD_FOR_ANDROID | 308 #ifdef SK_BUILD_FOR_ANDROID |
277 SkMutex fDrawMutex; | 309 SkMutex fDrawMutex; |
278 bool fAbortCurrentPlayback; | 310 bool fAbortCurrentPlayback; |
279 #endif | 311 #endif |
280 }; | 312 }; |
281 | 313 |
282 #endif | 314 #endif |
OLD | NEW |