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 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 /** \class SkPicture | 28 /** \class SkPicture |
29 | 29 |
30 The SkPicture class records the drawing commands made to a canvas, to | 30 The SkPicture class records the drawing commands made to a canvas, to |
31 be played back at a later time. | 31 be played back at a later time. |
32 */ | 32 */ |
33 class SK_API SkPicture : public SkRefCnt { | 33 class SK_API SkPicture : public SkRefCnt { |
34 public: | 34 public: |
35 SK_DECLARE_INST_COUNT(SkPicture) | 35 SK_DECLARE_INST_COUNT(SkPicture) |
36 | 36 |
37 // SkAccelData provides a base class for device-specific acceleration | |
38 // data. It is added to the picture via a call to a device's optimize | |
39 // method. | |
40 class SkAccelData : public SkRefCnt { | |
41 public: | |
42 SkAccelData(uint32_t id) : fID(id) { } | |
43 | |
44 uint32_t getID() const { return fID; } | |
45 | |
46 private: | |
47 uint32_t fID; | |
48 | |
49 typedef SkRefCnt INHERITED; | |
50 }; | |
51 | |
37 /** The constructor prepares the picture to record. | 52 /** The constructor prepares the picture to record. |
38 @param width the width of the virtual device the picture records. | 53 @param width the width of the virtual device the picture records. |
39 @param height the height of the virtual device the picture records. | 54 @param height the height of the virtual device the picture records. |
40 */ | 55 */ |
41 SkPicture(); | 56 SkPicture(); |
42 /** Make a copy of the contents of src. If src records more drawing after | 57 /** Make a copy of the contents of src. If src records more drawing after |
43 this call, those elements will not appear in this picture. | 58 this call, those elements will not appear in this picture. |
44 */ | 59 */ |
45 SkPicture(const SkPicture& src); | 60 SkPicture(const SkPicture& src); |
46 | 61 |
62 void setAccelData(const SkAccelData* data) { SkRefCnt_SafeAssign(fAccelData, data); } | |
bsalomon
2014/03/12 15:34:34
If we ever have other backends that want to optimi
robertphillips
2014/03/13 12:43:42
Done. I have updated the interface to support this
| |
63 const SkAccelData* getAccelData() const { return fAccelData; } | |
64 | |
47 /** | 65 /** |
48 * Function signature defining a function that sets up an SkBitmap from enc oded data. On | 66 * Function signature defining a function that sets up an SkBitmap from enc oded data. On |
49 * success, the SkBitmap should have its Config, width, height, rowBytes an d pixelref set. | 67 * success, the SkBitmap should have its Config, width, height, rowBytes an d pixelref set. |
50 * If the installed pixelref has decoded the data into pixels, then the src buffer need not be | 68 * If the installed pixelref has decoded the data into pixels, then the src buffer need not be |
51 * copied. If the pixelref defers the actual decode until its lockPixels() is called, then it | 69 * copied. If the pixelref defers the actual decode until its lockPixels() is called, then it |
52 * must make a copy of the src buffer. | 70 * must make a copy of the src buffer. |
53 * @param src Encoded data. | 71 * @param src Encoded data. |
54 * @param length Size of the encoded data, in bytes. | 72 * @param length Size of the encoded data, in bytes. |
55 * @param dst SkBitmap to install the pixel ref on. | 73 * @param dst SkBitmap to install the pixel ref on. |
56 * @param bool Whether or not a pixel ref was successfully installed. | 74 * @param bool Whether or not a pixel ref was successfully installed. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 // Note: If the picture version needs to be increased then please follow the | 273 // Note: If the picture version needs to be increased then please follow the |
256 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw | 274 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw |
257 | 275 |
258 // Only SKPs within the min/current picture version range (inclusive) can be read. | 276 // Only SKPs within the min/current picture version range (inclusive) can be read. |
259 static const uint32_t MIN_PICTURE_VERSION = 19; | 277 static const uint32_t MIN_PICTURE_VERSION = 19; |
260 static const uint32_t CURRENT_PICTURE_VERSION = 22; | 278 static const uint32_t CURRENT_PICTURE_VERSION = 22; |
261 | 279 |
262 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to | 280 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to |
263 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed | 281 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed |
264 // recorders and set the picture size | 282 // recorders and set the picture size |
265 SkPicturePlayback* fPlayback; | 283 SkPicturePlayback* fPlayback; |
266 SkPictureRecord* fRecord; | 284 SkPictureRecord* fRecord; |
267 int fWidth, fHeight; | 285 int fWidth, fHeight; |
286 const SkAccelData* fAccelData; | |
268 | 287 |
269 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of | 288 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of |
270 // playback is unchanged. | 289 // playback is unchanged. |
271 SkPicture(SkPicturePlayback*, int width, int height); | 290 SkPicture(SkPicturePlayback*, int width, int height); |
272 | 291 |
273 // For testing. Derived classes may instantiate an alternate | 292 // For testing. Derived classes may instantiate an alternate |
274 // SkBBoxHierarchy implementation | 293 // SkBBoxHierarchy implementation |
275 virtual SkBBoxHierarchy* createBBoxHierarchy() const; | 294 virtual SkBBoxHierarchy* createBBoxHierarchy() const; |
276 private: | 295 private: |
277 void createHeader(void* header) const; | 296 void createHeader(void* header) const; |
(...skipping 16 matching lines...) Expand all Loading... | |
294 */ | 313 */ |
295 class SK_API SkDrawPictureCallback { | 314 class SK_API SkDrawPictureCallback { |
296 public: | 315 public: |
297 SkDrawPictureCallback() {} | 316 SkDrawPictureCallback() {} |
298 virtual ~SkDrawPictureCallback() {} | 317 virtual ~SkDrawPictureCallback() {} |
299 | 318 |
300 virtual bool abortDrawing() = 0; | 319 virtual bool abortDrawing() = 0; |
301 }; | 320 }; |
302 | 321 |
303 #endif | 322 #endif |
OLD | NEW |