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 |
11 #define SkPicture_DEFINED | 11 #define SkPicture_DEFINED |
12 | 12 |
13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
14 #include "SkDrawPictureCallback.h" | 14 #include "SkDrawPictureCallback.h" |
15 #include "SkImageDecoder.h" | 15 #include "SkImageDecoder.h" |
16 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
17 | 17 |
18 #if SK_SUPPORT_GPU | 18 #if SK_SUPPORT_GPU |
19 class GrContext; | 19 class GrContext; |
20 #endif | 20 #endif |
21 | 21 |
22 class SkBBHFactory; | 22 class SkBBHFactory; |
23 class SkBBoxHierarchy; | 23 class SkBBoxHierarchy; |
24 class SkCanvas; | 24 class SkCanvas; |
25 class SkData; | 25 class SkData; |
26 class SkPicturePlayback; | 26 class SkPictureData; |
27 class SkPictureRecord; | 27 class SkPictureRecord; |
28 class SkStream; | 28 class SkStream; |
29 class SkWStream; | 29 class SkWStream; |
30 | 30 |
31 struct SkPictInfo; | 31 struct SkPictInfo; |
32 | 32 |
33 class SkRecord; | 33 class SkRecord; |
34 | 34 |
35 /** \class SkPicture | 35 /** \class SkPicture |
36 | 36 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 // Note: If the picture version needs to be increased then please follow the | 243 // Note: If the picture version needs to be increased then please follow the |
244 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw | 244 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw |
245 | 245 |
246 // Only SKPs within the min/current picture version range (inclusive) can be
read. | 246 // Only SKPs within the min/current picture version range (inclusive) can be
read. |
247 static const uint32_t MIN_PICTURE_VERSION = 19; | 247 static const uint32_t MIN_PICTURE_VERSION = 19; |
248 static const uint32_t CURRENT_PICTURE_VERSION = 29; | 248 static const uint32_t CURRENT_PICTURE_VERSION = 29; |
249 | 249 |
250 mutable uint32_t fUniqueID; | 250 mutable uint32_t fUniqueID; |
251 | 251 |
252 // fPlayback, fWidth & fHeight are protected to allow derived classes to | 252 // TODO: make fData and fWidth/fHeight private |
253 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv
ed | 253 SkAutoTDelete<SkPictureData> fData; |
254 // recorders and set the picture size | |
255 SkAutoTDelete<SkPicturePlayback> fPlayback; | |
256 int fWidth, fHeight; | 254 int fWidth, fHeight; |
257 mutable SkAutoTUnref<const AccelData> fAccelData; | 255 mutable SkAutoTUnref<const AccelData> fAccelData; |
258 | 256 |
259 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } | 257 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } |
260 | 258 |
261 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of | 259 // Create a new SkPicture from an existing SkPictureData. Ref count of |
262 // playback is unchanged. | 260 // data is unchanged. |
263 SkPicture(SkPicturePlayback*, int width, int height); | 261 SkPicture(SkPictureData* data, int width, int height); |
264 | 262 |
265 SkPicture(int width, int height, const SkPictureRecord& record, bool deepCop
yOps); | 263 SkPicture(int width, int height, const SkPictureRecord& record, bool deepCop
yOps); |
266 | 264 |
267 private: | 265 private: |
268 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); | 266 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); |
269 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); | 267 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); |
270 | 268 |
271 // An OperationList encapsulates a set of operation offsets into the picture
byte | 269 // An OperationList encapsulates a set of operation offsets into the picture
byte |
272 // stream along with the CTMs needed for those operation. | 270 // stream along with the CTMs needed for those operation. |
273 class OperationList : ::SkNoncopyable { | 271 class OperationList : ::SkNoncopyable { |
(...skipping 23 matching lines...) Expand all Loading... |
297 /** PRIVATE / EXPERIMENTAL -- do not call | 295 /** PRIVATE / EXPERIMENTAL -- do not call |
298 Return the ID of the operation currently being executed when playing | 296 Return the ID of the operation currently being executed when playing |
299 back. 0 indicates no call is active. | 297 back. 0 indicates no call is active. |
300 */ | 298 */ |
301 size_t EXPERIMENTAL_curOpID() const; | 299 size_t EXPERIMENTAL_curOpID() const; |
302 | 300 |
303 void createHeader(SkPictInfo* info) const; | 301 void createHeader(SkPictInfo* info) const; |
304 static bool IsValidPictInfo(const SkPictInfo& info); | 302 static bool IsValidPictInfo(const SkPictInfo& info); |
305 | 303 |
306 friend class SkFlatPicture; | 304 friend class SkFlatPicture; |
307 friend class SkPicturePlayback; | 305 friend class SkPictureData; |
308 friend class SkPictureRecorder; // just for SkPicture-based constructor | 306 friend class SkPictureRecorder; // just for SkPicture-based constructor |
309 friend class SkGpuDevice; | 307 friend class SkGpuDevice; |
310 friend class GrGatherCanvas; | 308 friend class GrGatherCanvas; |
311 friend class GrGatherDevice; | 309 friend class GrGatherDevice; |
312 friend class SkDebugCanvas; | 310 friend class SkDebugCanvas; |
313 | 311 |
314 typedef SkRefCnt INHERITED; | 312 typedef SkRefCnt INHERITED; |
315 | 313 |
316 SkPicture(int width, int height, SkRecord*); // Takes ownership. | 314 SkPicture(int width, int height, SkRecord*); // Takes ownership. |
317 SkAutoTDelete<SkRecord> fRecord; | 315 SkAutoTDelete<SkRecord> fRecord; |
318 }; | 316 }; |
319 | 317 |
320 #endif | 318 #endif |
OLD | NEW |