OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "SkPictureFlat.h" | 9 #include "SkPictureFlat.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
11 #include "SkPicturePlayback.h" | 11 #include "SkPicturePlayback.h" |
12 #include "SkPictureRecord.h" | 12 #include "SkPictureRecord.h" |
13 #include "SkPictureRecorder.h" | 13 #include "SkPictureRecorder.h" |
14 | 14 |
15 #include "SkBitmapDevice.h" | 15 #include "SkBitmapDevice.h" |
16 #include "SkCanvas.h" | 16 #include "SkCanvas.h" |
17 #include "SkChunkAlloc.h" | 17 #include "SkChunkAlloc.h" |
| 18 #include "SkDrawPictureCallback.h" |
18 #include "SkMessageBus.h" | 19 #include "SkMessageBus.h" |
19 #include "SkPaintPriv.h" | 20 #include "SkPaintPriv.h" |
20 #include "SkPathEffect.h" | 21 #include "SkPathEffect.h" |
21 #include "SkPicture.h" | 22 #include "SkPicture.h" |
22 #include "SkRegion.h" | 23 #include "SkRegion.h" |
23 #include "SkShader.h" | 24 #include "SkShader.h" |
24 #include "SkStream.h" | 25 #include "SkStream.h" |
25 #include "SkTDArray.h" | 26 #include "SkTDArray.h" |
26 #include "SkTLogic.h" | 27 #include "SkTLogic.h" |
27 #include "SkTSearch.h" | 28 #include "SkTSearch.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 int32_t id = sk_atomic_inc(&gNextID); | 303 int32_t id = sk_atomic_inc(&gNextID); |
303 if (id >= 1 << (8 * sizeof(Domain))) { | 304 if (id >= 1 << (8 * sizeof(Domain))) { |
304 SK_CRASH(); | 305 SK_CRASH(); |
305 } | 306 } |
306 | 307 |
307 return static_cast<Domain>(id); | 308 return static_cast<Domain>(id); |
308 } | 309 } |
309 | 310 |
310 /////////////////////////////////////////////////////////////////////////////// | 311 /////////////////////////////////////////////////////////////////////////////// |
311 | 312 |
312 void SkPicture::playback(SkCanvas* canvas, AbortCallback* callback) const { | 313 void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) cons
t { |
313 SkASSERT(canvas); | 314 SkASSERT(canvas); |
314 | 315 |
315 // If the query contains the whole picture, don't bother with the BBH. | 316 // If the query contains the whole picture, don't bother with the BBH. |
316 SkRect clipBounds = { 0, 0, 0, 0 }; | 317 SkRect clipBounds = { 0, 0, 0, 0 }; |
317 (void)canvas->getClipBounds(&clipBounds); | 318 (void)canvas->getClipBounds(&clipBounds); |
318 const bool useBBH = !clipBounds.contains(this->cullRect()); | 319 const bool useBBH = !clipBounds.contains(this->cullRect()); |
319 | 320 |
320 SkRecordDraw(*fRecord, canvas, this->drawablePicts(), NULL, this->drawableCo
unt(), | 321 SkRecordDraw(*fRecord, canvas, this->drawablePicts(), NULL, this->drawableCo
unt(), |
321 useBBH ? fBBH.get() : NULL, callback); | 322 useBBH ? fBBH.get() : NULL, callback); |
322 } | 323 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 498 |
498 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, | 499 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, |
499 SkBBoxHierarchy* bbh) | 500 SkBBoxHierarchy* bbh) |
500 : fUniqueID(next_picture_generation_id()) | 501 : fUniqueID(next_picture_generation_id()) |
501 , fCullRect(cullRect) | 502 , fCullRect(cullRect) |
502 , fRecord(SkRef(record)) | 503 , fRecord(SkRef(record)) |
503 , fBBH(SkSafeRef(bbh)) | 504 , fBBH(SkSafeRef(bbh)) |
504 , fDrawablePicts(drawablePicts) // take ownership | 505 , fDrawablePicts(drawablePicts) // take ownership |
505 , fAnalysis(*fRecord) | 506 , fAnalysis(*fRecord) |
506 {} | 507 {} |
OLD | NEW |