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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 | 52 |
53 // This entry point allows user's to get a unique domain prefix | 53 // This entry point allows user's to get a unique domain prefix |
54 // for their keys | 54 // for their keys |
55 static Domain GenerateDomain(); | 55 static Domain GenerateDomain(); |
56 private: | 56 private: |
57 Key fKey; | 57 Key fKey; |
58 | 58 |
59 typedef SkRefCnt INHERITED; | 59 typedef SkRefCnt INHERITED; |
60 }; | 60 }; |
61 | 61 |
62 /** The constructor prepares the picture to record. | |
63 @param width the width of the virtual device the picture records. | |
64 @param height the height of the virtual device the picture records. | |
65 */ | |
66 SkPicture(); | 62 SkPicture(); |
67 /** Make a copy of the contents of src. If src records more drawing after | 63 /** Make a copy of the contents of src. If src records more drawing after |
68 this call, those elements will not appear in this picture. | 64 this call, those elements will not appear in this picture. |
69 */ | 65 */ |
70 SkPicture(const SkPicture& src); | 66 SkPicture(const SkPicture& src); |
71 | 67 |
72 /** PRIVATE / EXPERIMENTAL -- do not call */ | 68 /** PRIVATE / EXPERIMENTAL -- do not call */ |
73 void EXPERIMENTAL_addAccelData(const AccelData* data) { | 69 void EXPERIMENTAL_addAccelData(const AccelData* data) { |
74 SkRefCnt_SafeAssign(fAccelData, data); | 70 SkRefCnt_SafeAssign(fAccelData, data); |
75 } | 71 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 */ | 194 */ |
199 int width() const { return fWidth; } | 195 int width() const { return fWidth; } |
200 | 196 |
201 /** Return the height of the picture's recording canvas. This | 197 /** Return the height of the picture's recording canvas. This |
202 value reflects what was passed to setSize(), and does not necessarily | 198 value reflects what was passed to setSize(), and does not necessarily |
203 reflect the bounds of what has been recorded into the picture. | 199 reflect the bounds of what has been recorded into the picture. |
204 @return the height of the picture's recording canvas | 200 @return the height of the picture's recording canvas |
205 */ | 201 */ |
206 int height() const { return fHeight; } | 202 int height() const { return fHeight; } |
207 | 203 |
204 static const uint32_t kInvalidGenID = 0; | |
reed1
2014/04/07 13:16:59
Seems like this should be in some larger/global he
| |
205 | |
206 /** Return a non-zero, unique value representing the picture. This call is | |
207 only valid when not recording. Between a beginRecording/endRecording | |
208 pair it will just return 0 (the invalid gen ID). Each beginRecording/ | |
209 endRecording pair will cause a different generation ID to be returned. | |
210 */ | |
211 uint32_t getGenerationID() const; | |
reed1
2014/04/07 13:16:59
Why not call it uniqueID() as we do in typeface?
| |
212 | |
208 /** | 213 /** |
209 * Function to encode an SkBitmap to an SkData. A function with this | 214 * Function to encode an SkBitmap to an SkData. A function with this |
210 * signature can be passed to serialize() and SkWriteBuffer. | 215 * signature can be passed to serialize() and SkWriteBuffer. |
211 * Returning NULL will tell the SkWriteBuffer to use | 216 * Returning NULL will tell the SkWriteBuffer to use |
212 * SkBitmap::flatten() to store the bitmap. | 217 * SkBitmap::flatten() to store the bitmap. |
213 * | 218 * |
214 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. | 219 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. |
215 * @return SkData If non-NULL, holds encoded data representing the passed | 220 * @return SkData If non-NULL, holds encoded data representing the passed |
216 * in bitmap. The caller is responsible for calling unref(). | 221 * in bitmap. The caller is responsible for calling unref(). |
217 */ | 222 */ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) | 285 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) |
281 // V8 : Add an option for encoding bitmaps | 286 // V8 : Add an option for encoding bitmaps |
282 // V9 : Allow the reader and writer of an SKP disagree on whether to support | 287 // V9 : Allow the reader and writer of an SKP disagree on whether to support |
283 // SK_SUPPORT_HINTING_SCALE_FACTOR | 288 // SK_SUPPORT_HINTING_SCALE_FACTOR |
284 // V10: add drawRRect, drawOval, clipRRect | 289 // V10: add drawRRect, drawOval, clipRRect |
285 // V11: modify how readBitmap and writeBitmap store their info. | 290 // V11: modify how readBitmap and writeBitmap store their info. |
286 // V12: add conics to SkPath, use new SkPathRef flattening | 291 // V12: add conics to SkPath, use new SkPathRef flattening |
287 // V13: add flag to drawBitmapRectToRect | 292 // V13: add flag to drawBitmapRectToRect |
288 // parameterize blurs by sigma rather than radius | 293 // parameterize blurs by sigma rather than radius |
289 // V14: Add flags word to PathRef serialization | 294 // V14: Add flags word to PathRef serialization |
290 // V15: Remove A1 bitmpa config (and renumber remaining configs) | 295 // V15: Remove A1 bitmap config (and renumber remaining configs) |
291 // V16: Move SkPath's isOval flag to SkPathRef | 296 // V16: Move SkPath's isOval flag to SkPathRef |
292 // V17: SkPixelRef now writes SkImageInfo | 297 // V17: SkPixelRef now writes SkImageInfo |
293 // V18: SkBitmap now records x,y for its pixelref origin, instead of offset. | 298 // V18: SkBitmap now records x,y for its pixelref origin, instead of offset. |
294 // V19: encode matrices and regions into the ops stream | 299 // V19: encode matrices and regions into the ops stream |
295 // V20: added bool to SkPictureImageFilter's serialization (to allow SkPictu re serialization) | 300 // V20: added bool to SkPictureImageFilter's serialization (to allow SkPictu re serialization) |
296 // V21: add pushCull, popCull | 301 // V21: add pushCull, popCull |
297 // V22: SK_PICT_FACTORY_TAG's size is now the chunk size in bytes | 302 // V22: SK_PICT_FACTORY_TAG's size is now the chunk size in bytes |
298 | 303 |
299 // Note: If the picture version needs to be increased then please follow the | 304 // Note: If the picture version needs to be increased then please follow the |
300 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw | 305 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw |
301 | 306 |
302 // Only SKPs within the min/current picture version range (inclusive) can be read. | 307 // Only SKPs within the min/current picture version range (inclusive) can be read. |
303 static const uint32_t MIN_PICTURE_VERSION = 19; | 308 static const uint32_t MIN_PICTURE_VERSION = 19; |
304 static const uint32_t CURRENT_PICTURE_VERSION = 22; | 309 static const uint32_t CURRENT_PICTURE_VERSION = 22; |
305 | 310 |
311 mutable uint32_t fGenerationID; | |
312 | |
306 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to | 313 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to |
307 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed | 314 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed |
308 // recorders and set the picture size | 315 // recorders and set the picture size |
309 SkPicturePlayback* fPlayback; | 316 SkPicturePlayback* fPlayback; |
310 SkPictureRecord* fRecord; | 317 SkPictureRecord* fRecord; |
311 int fWidth, fHeight; | 318 int fWidth, fHeight; |
312 const AccelData* fAccelData; | 319 const AccelData* fAccelData; |
313 | 320 |
321 void needsNewGenID() { fGenerationID = kInvalidGenID; } | |
322 | |
314 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of | 323 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of |
315 // playback is unchanged. | 324 // playback is unchanged. |
316 SkPicture(SkPicturePlayback*, int width, int height); | 325 SkPicture(SkPicturePlayback*, int width, int height); |
317 | 326 |
318 // For testing. Derived classes may instantiate an alternate | 327 // For testing. Derived classes may instantiate an alternate |
319 // SkBBoxHierarchy implementation | 328 // SkBBoxHierarchy implementation |
320 virtual SkBBoxHierarchy* createBBoxHierarchy() const; | 329 virtual SkBBoxHierarchy* createBBoxHierarchy() const; |
321 private: | 330 private: |
322 // An OperationList encapsulates a set of operation offsets into the picture byte | 331 // An OperationList encapsulates a set of operation offsets into the picture byte |
323 // stream along with the CTMs needed for those operation. | 332 // stream along with the CTMs needed for those operation. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 */ | 387 */ |
379 class SK_API SkDrawPictureCallback { | 388 class SK_API SkDrawPictureCallback { |
380 public: | 389 public: |
381 SkDrawPictureCallback() {} | 390 SkDrawPictureCallback() {} |
382 virtual ~SkDrawPictureCallback() {} | 391 virtual ~SkDrawPictureCallback() {} |
383 | 392 |
384 virtual bool abortDrawing() = 0; | 393 virtual bool abortDrawing() = 0; |
385 }; | 394 }; |
386 | 395 |
387 #endif | 396 #endif |
OLD | NEW |