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 "SkImageDecoder.h" | 14 #include "SkImageDecoder.h" |
15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
16 | 16 |
17 #if SK_SUPPORT_GPU | 17 #if SK_SUPPORT_GPU |
18 class GrContext; | 18 class GrContext; |
19 #endif | 19 #endif |
20 | 20 |
21 class SkBBHFactory; | 21 class SkBBHFactory; |
22 class SkBBoxHierarchy; | 22 class SkBBoxHierarchy; |
23 class SkCanvas; | 23 class SkCanvas; |
24 class SkDrawPictureCallback; | 24 class SkDrawPictureCallback; |
25 class SkData; | 25 class SkData; |
26 class SkPathHeap; | |
27 class SkPicturePlayback; | 26 class SkPicturePlayback; |
28 class SkPictureRecord; | 27 class SkPictureRecord; |
29 class SkStream; | 28 class SkStream; |
30 class SkWStream; | 29 class SkWStream; |
31 | 30 |
32 struct SkPictInfo; | 31 struct SkPictInfo; |
33 | 32 |
34 /** \class SkPicture | 33 /** \class SkPicture |
35 | 34 |
36 The SkPicture class records the drawing commands made to a canvas, to | 35 The SkPicture class records the drawing commands made to a canvas, to |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 SkPicturePlayback* fPlayback; | 278 SkPicturePlayback* fPlayback; |
280 int fWidth, fHeight; | 279 int fWidth, fHeight; |
281 mutable const AccelData* fAccelData; | 280 mutable const AccelData* fAccelData; |
282 | 281 |
283 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } | 282 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } |
284 | 283 |
285 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of | 284 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of |
286 // playback is unchanged. | 285 // playback is unchanged. |
287 SkPicture(SkPicturePlayback*, int width, int height); | 286 SkPicture(SkPicturePlayback*, int width, int height); |
288 | 287 |
289 SkPicture(int width, int height, SkPictureRecord& record, bool deepCopyOps); | 288 SkPicture(int width, int height, const SkPictureRecord& record, bool deepCop
yOps); |
290 | 289 |
291 private: | 290 private: |
292 SkAutoTUnref<SkPathHeap> fPathHeap; // reference counted | |
293 | |
294 const SkPath& getPath(int index) const; | |
295 int addPathToHeap(const SkPath& path); | |
296 | |
297 void flattenToBuffer(SkWriteBuffer& buffer) const; | |
298 bool parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t size); | |
299 | |
300 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); | 291 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); |
301 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); | 292 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); |
302 | 293 |
303 void initForPlayback() const; | |
304 void dumpSize() const; | |
305 | |
306 // An OperationList encapsulates a set of operation offsets into the picture
byte | 294 // An OperationList encapsulates a set of operation offsets into the picture
byte |
307 // stream along with the CTMs needed for those operation. | 295 // stream along with the CTMs needed for those operation. |
308 class OperationList : ::SkNoncopyable { | 296 class OperationList : ::SkNoncopyable { |
309 public: | 297 public: |
310 virtual ~OperationList() {} | 298 virtual ~OperationList() {} |
311 | 299 |
312 // If valid returns false then there is no optimization data | 300 // If valid returns false then there is no optimization data |
313 // present. All the draw operations need to be issued. | 301 // present. All the draw operations need to be issued. |
314 virtual bool valid() const { return false; } | 302 virtual bool valid() const { return false; } |
315 | 303 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 */ | 349 */ |
362 class SK_API SkDrawPictureCallback { | 350 class SK_API SkDrawPictureCallback { |
363 public: | 351 public: |
364 SkDrawPictureCallback() {} | 352 SkDrawPictureCallback() {} |
365 virtual ~SkDrawPictureCallback() {} | 353 virtual ~SkDrawPictureCallback() {} |
366 | 354 |
367 virtual bool abortDrawing() = 0; | 355 virtual bool abortDrawing() = 0; |
368 }; | 356 }; |
369 | 357 |
370 #endif | 358 #endif |
OLD | NEW |