OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
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 | 8 |
9 | 9 |
10 #ifndef SkPicture_DEFINED | 10 #ifndef SkPicture_DEFINED |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 | 210 |
211 #ifdef SK_BUILD_FOR_ANDROID | 211 #ifdef SK_BUILD_FOR_ANDROID |
212 /** Signals that the caller is prematurely done replaying the drawing | 212 /** Signals that the caller is prematurely done replaying the drawing |
213 commands. This can be called from a canvas virtual while the picture | 213 commands. This can be called from a canvas virtual while the picture |
214 is drawing. Has no effect if the picture is not drawing. | 214 is drawing. Has no effect if the picture is not drawing. |
215 @deprecated preserving for legacy purposes | 215 @deprecated preserving for legacy purposes |
216 */ | 216 */ |
217 void abortPlayback(); | 217 void abortPlayback(); |
218 #endif | 218 #endif |
219 | 219 |
220 // Return true if the SkStream represents a serialized picture, and fills ou t | |
221 // SkPictInfo. After this function returns, the SkStream is not rewound; it | |
222 // will be ready to be parsed to create an SkPicturePlayback. | |
reed1
2014/03/03 15:18:24
This part about "ready to be parsed..." is confusi
robertphillips
2014/03/03 15:29:29
Done. Hopefully clearer.
| |
223 // If false is returned, SkPictInfo is unmodified. | |
224 static bool StreamIsSKP(SkStream*, SkPictInfo*); | |
225 static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*); | |
226 | |
220 protected: | 227 protected: |
221 // V2 : adds SkPixelRef's generation ID. | 228 // V2 : adds SkPixelRef's generation ID. |
222 // V3 : PictInfo tag at beginning, and EOF tag at the end | 229 // V3 : PictInfo tag at beginning, and EOF tag at the end |
223 // V4 : move SkPictInfo to be the header | 230 // V4 : move SkPictInfo to be the header |
224 // V5 : don't read/write FunctionPtr on cross-process (we can detect that) | 231 // V5 : don't read/write FunctionPtr on cross-process (we can detect that) |
225 // V6 : added serialization of SkPath's bounds (and packed its flags tighter ) | 232 // V6 : added serialization of SkPath's bounds (and packed its flags tighter ) |
226 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) | 233 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) |
227 // V8 : Add an option for encoding bitmaps | 234 // V8 : Add an option for encoding bitmaps |
228 // V9 : Allow the reader and writer of an SKP disagree on whether to support | 235 // V9 : Allow the reader and writer of an SKP disagree on whether to support |
229 // SK_SUPPORT_HINTING_SCALE_FACTOR | 236 // SK_SUPPORT_HINTING_SCALE_FACTOR |
(...skipping 25 matching lines...) Expand all Loading... | |
255 SkPictureRecord* fRecord; | 262 SkPictureRecord* fRecord; |
256 int fWidth, fHeight; | 263 int fWidth, fHeight; |
257 | 264 |
258 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of | 265 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of |
259 // playback is unchanged. | 266 // playback is unchanged. |
260 SkPicture(SkPicturePlayback*, int width, int height); | 267 SkPicture(SkPicturePlayback*, int width, int height); |
261 | 268 |
262 // For testing. Derived classes may instantiate an alternate | 269 // For testing. Derived classes may instantiate an alternate |
263 // SkBBoxHierarchy implementation | 270 // SkBBoxHierarchy implementation |
264 virtual SkBBoxHierarchy* createBBoxHierarchy() const; | 271 virtual SkBBoxHierarchy* createBBoxHierarchy() const; |
265 | |
266 // Return true if the SkStream represents a serialized picture, and fills ou t | |
267 // SkPictInfo. After this function returns, the SkStream is not rewound; it | |
268 // will be ready to be parsed to create an SkPicturePlayback. | |
269 // If false is returned, SkPictInfo is unmodified. | |
270 static bool StreamIsSKP(SkStream*, SkPictInfo*); | |
271 static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*); | |
272 private: | 272 private: |
273 void createHeader(void* header) const; | 273 void createHeader(void* header) const; |
274 | 274 |
275 friend class SkFlatPicture; | 275 friend class SkFlatPicture; |
276 friend class SkPicturePlayback; | 276 friend class SkPicturePlayback; |
277 | 277 |
278 typedef SkRefCnt INHERITED; | 278 typedef SkRefCnt INHERITED; |
279 }; | 279 }; |
280 | 280 |
281 /** | 281 /** |
282 * Subclasses of this can be passed to canvas.drawPicture. During the drawing | 282 * Subclasses of this can be passed to canvas.drawPicture. During the drawing |
283 * of the picture, this callback will periodically be invoked. If its | 283 * of the picture, this callback will periodically be invoked. If its |
284 * abortDrawing() returns true, then picture playback will be interrupted. | 284 * abortDrawing() returns true, then picture playback will be interrupted. |
285 * | 285 * |
286 * The resulting drawing is undefined, as there is no guarantee how often the | 286 * The resulting drawing is undefined, as there is no guarantee how often the |
287 * callback will be invoked. If the abort happens inside some level of nested | 287 * callback will be invoked. If the abort happens inside some level of nested |
288 * calls to save(), restore will automatically be called to return the state | 288 * calls to save(), restore will automatically be called to return the state |
289 * to the same level it was before the drawPicture call was made. | 289 * to the same level it was before the drawPicture call was made. |
290 */ | 290 */ |
291 class SK_API SkDrawPictureCallback { | 291 class SK_API SkDrawPictureCallback { |
292 public: | 292 public: |
293 SkDrawPictureCallback() {} | 293 SkDrawPictureCallback() {} |
294 virtual ~SkDrawPictureCallback() {} | 294 virtual ~SkDrawPictureCallback() {} |
295 | 295 |
296 virtual bool abortDrawing() = 0; | 296 virtual bool abortDrawing() = 0; |
297 }; | 297 }; |
298 | 298 |
299 #endif | 299 #endif |
OLD | NEW |