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 #include "SkPictureFlat.h" | 10 #include "SkPictureFlat.h" |
11 #include "SkPictureData.h" | 11 #include "SkPictureData.h" |
12 #include "SkPicturePlayback.h" | 12 #include "SkPicturePlayback.h" |
13 #include "SkPictureRecord.h" | 13 #include "SkPictureRecord.h" |
14 #include "SkPictureRecorder.h" | 14 #include "SkPictureRecorder.h" |
| 15 #include "SkPictureStateTree.h" |
15 | 16 |
16 #include "SkBBHFactory.h" | 17 #include "SkBBHFactory.h" |
17 #include "SkBitmapDevice.h" | 18 #include "SkBitmapDevice.h" |
18 #include "SkCanvas.h" | 19 #include "SkCanvas.h" |
19 #include "SkChunkAlloc.h" | 20 #include "SkChunkAlloc.h" |
20 #include "SkDrawPictureCallback.h" | 21 #include "SkDrawPictureCallback.h" |
21 #include "SkPaintPriv.h" | 22 #include "SkPaintPriv.h" |
22 #include "SkPicture.h" | 23 #include "SkPicture.h" |
23 #include "SkRecordAnalysis.h" | 24 #include "SkRecordAnalysis.h" |
24 #include "SkRegion.h" | 25 #include "SkRegion.h" |
(...skipping 14 matching lines...) Expand all Loading... |
39 #include "SkRecord.h" | 40 #include "SkRecord.h" |
40 #include "SkRecordDraw.h" | 41 #include "SkRecordDraw.h" |
41 #include "SkRecorder.h" | 42 #include "SkRecorder.h" |
42 | 43 |
43 template <typename T> int SafeCount(const T* obj) { | 44 template <typename T> int SafeCount(const T* obj) { |
44 return obj ? obj->count() : 0; | 45 return obj ? obj->count() : 0; |
45 } | 46 } |
46 | 47 |
47 #define DUMP_BUFFER_SIZE 65536 | 48 #define DUMP_BUFFER_SIZE 65536 |
48 | 49 |
49 //#define ENABLE_TIME_DRAW // dumps milliseconds for each draw | |
50 | |
51 | |
52 #ifdef SK_DEBUG | 50 #ifdef SK_DEBUG |
53 // enable SK_DEBUG_TRACE to trace DrawType elements when | 51 // enable SK_DEBUG_TRACE to trace DrawType elements when |
54 // recorded and played back | 52 // recorded and played back |
55 // #define SK_DEBUG_TRACE | 53 // #define SK_DEBUG_TRACE |
56 // enable SK_DEBUG_SIZE to see the size of picture components | 54 // enable SK_DEBUG_SIZE to see the size of picture components |
57 // #define SK_DEBUG_SIZE | 55 // #define SK_DEBUG_SIZE |
58 // enable SK_DEBUG_DUMP to see the contents of recorded elements | 56 // enable SK_DEBUG_DUMP to see the contents of recorded elements |
59 // #define SK_DEBUG_DUMP | 57 // #define SK_DEBUG_DUMP |
60 // enable SK_DEBUG_VALIDATE to check internal structures for consistency | 58 // enable SK_DEBUG_VALIDATE to check internal structures for consistency |
61 // #define SK_DEBUG_VALIDATE | 59 // #define SK_DEBUG_VALIDATE |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 int32_t id = sk_atomic_inc(&gNextID); | 284 int32_t id = sk_atomic_inc(&gNextID); |
287 if (id >= 1 << (8 * sizeof(Domain))) { | 285 if (id >= 1 << (8 * sizeof(Domain))) { |
288 SK_CRASH(); | 286 SK_CRASH(); |
289 } | 287 } |
290 | 288 |
291 return static_cast<Domain>(id); | 289 return static_cast<Domain>(id); |
292 } | 290 } |
293 | 291 |
294 /////////////////////////////////////////////////////////////////////////////// | 292 /////////////////////////////////////////////////////////////////////////////// |
295 | 293 |
| 294 uint32_t SkPicture::OperationList::offset(int index) const { |
| 295 SkASSERT(index < fOps.count()); |
| 296 return ((SkPictureStateTree::Draw*)fOps[index])->fOffset; |
| 297 } |
| 298 |
| 299 const SkMatrix& SkPicture::OperationList::matrix(int index) const { |
| 300 SkASSERT(index < fOps.count()); |
| 301 return *((SkPictureStateTree::Draw*)fOps[index])->fMatrix; |
| 302 } |
| 303 |
296 // fRecord TODO | 304 // fRecord TODO |
297 const SkPicture::OperationList* SkPicture::EXPERIMENTAL_getActiveOps(const SkIRe
ct& queryRect) const { | 305 const SkPicture::OperationList* SkPicture::EXPERIMENTAL_getActiveOps(const SkIRe
ct& queryRect) const { |
298 SkASSERT(NULL != fData.get()); | 306 SkASSERT(NULL != fData.get()); |
299 if (NULL != fData.get()) { | 307 if (NULL != fData.get()) { |
300 return fData->getActiveOps(queryRect); | 308 return fData->getActiveOps(queryRect); |
301 } | 309 } |
302 return NULL; | 310 return NULL; |
303 } | 311 } |
304 | 312 |
305 // fRecord OK | 313 // fRecord OK |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 } | 555 } |
548 | 556 |
549 // fRecord OK | 557 // fRecord OK |
550 SkPicture::SkPicture(int width, int height, SkRecord* record) | 558 SkPicture::SkPicture(int width, int height, SkRecord* record) |
551 : fWidth(width) | 559 : fWidth(width) |
552 , fHeight(height) | 560 , fHeight(height) |
553 , fRecord(record) | 561 , fRecord(record) |
554 , fRecordWillPlayBackBitmaps(SkRecordWillPlaybackBitmaps(*record)) { | 562 , fRecordWillPlayBackBitmaps(SkRecordWillPlaybackBitmaps(*record)) { |
555 this->needsNewGenID(); | 563 this->needsNewGenID(); |
556 } | 564 } |
OLD | NEW |