| 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/Buffer represents a serialized picture, and |
| 221 fills out SkPictInfo. After this function returns, the data source is no
t |
| 222 rewound so it will have to be manually reset before passing to |
| 223 CreateFromStream or CreateFromBuffer. Note, CreateFromStream and |
| 224 CreateFromBuffer perform this check internally so these entry points are |
| 225 intended for stand alone tools. |
| 226 If false is returned, SkPictInfo is unmodified. |
| 227 */ |
| 228 static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*); |
| 229 static bool InternalOnly_BufferIsSKP(SkReadBuffer&, SkPictInfo*); |
| 230 |
| 220 protected: | 231 protected: |
| 221 // V2 : adds SkPixelRef's generation ID. | 232 // V2 : adds SkPixelRef's generation ID. |
| 222 // V3 : PictInfo tag at beginning, and EOF tag at the end | 233 // V3 : PictInfo tag at beginning, and EOF tag at the end |
| 223 // V4 : move SkPictInfo to be the header | 234 // V4 : move SkPictInfo to be the header |
| 224 // V5 : don't read/write FunctionPtr on cross-process (we can detect that) | 235 // 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
) | 236 // V6 : added serialization of SkPath's bounds (and packed its flags tighter
) |
| 226 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) | 237 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) |
| 227 // V8 : Add an option for encoding bitmaps | 238 // V8 : Add an option for encoding bitmaps |
| 228 // V9 : Allow the reader and writer of an SKP disagree on whether to support | 239 // V9 : Allow the reader and writer of an SKP disagree on whether to support |
| 229 // SK_SUPPORT_HINTING_SCALE_FACTOR | 240 // SK_SUPPORT_HINTING_SCALE_FACTOR |
| (...skipping 25 matching lines...) Expand all Loading... |
| 255 SkPictureRecord* fRecord; | 266 SkPictureRecord* fRecord; |
| 256 int fWidth, fHeight; | 267 int fWidth, fHeight; |
| 257 | 268 |
| 258 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of | 269 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of |
| 259 // playback is unchanged. | 270 // playback is unchanged. |
| 260 SkPicture(SkPicturePlayback*, int width, int height); | 271 SkPicture(SkPicturePlayback*, int width, int height); |
| 261 | 272 |
| 262 // For testing. Derived classes may instantiate an alternate | 273 // For testing. Derived classes may instantiate an alternate |
| 263 // SkBBoxHierarchy implementation | 274 // SkBBoxHierarchy implementation |
| 264 virtual SkBBoxHierarchy* createBBoxHierarchy() const; | 275 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: | 276 private: |
| 273 void createHeader(void* header) const; | 277 void createHeader(void* header) const; |
| 274 | 278 |
| 275 friend class SkFlatPicture; | 279 friend class SkFlatPicture; |
| 276 friend class SkPicturePlayback; | 280 friend class SkPicturePlayback; |
| 277 | 281 |
| 278 typedef SkRefCnt INHERITED; | 282 typedef SkRefCnt INHERITED; |
| 279 }; | 283 }; |
| 280 | 284 |
| 281 /** | 285 /** |
| 282 * Subclasses of this can be passed to canvas.drawPicture. During the drawing | 286 * Subclasses of this can be passed to canvas.drawPicture. During the drawing |
| 283 * of the picture, this callback will periodically be invoked. If its | 287 * of the picture, this callback will periodically be invoked. If its |
| 284 * abortDrawing() returns true, then picture playback will be interrupted. | 288 * abortDrawing() returns true, then picture playback will be interrupted. |
| 285 * | 289 * |
| 286 * The resulting drawing is undefined, as there is no guarantee how often the | 290 * 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 | 291 * 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 | 292 * 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. | 293 * to the same level it was before the drawPicture call was made. |
| 290 */ | 294 */ |
| 291 class SK_API SkDrawPictureCallback { | 295 class SK_API SkDrawPictureCallback { |
| 292 public: | 296 public: |
| 293 SkDrawPictureCallback() {} | 297 SkDrawPictureCallback() {} |
| 294 virtual ~SkDrawPictureCallback() {} | 298 virtual ~SkDrawPictureCallback() {} |
| 295 | 299 |
| 296 virtual bool abortDrawing() = 0; | 300 virtual bool abortDrawing() = 0; |
| 297 }; | 301 }; |
| 298 | 302 |
| 299 #endif | 303 #endif |
| OLD | NEW |