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" | |
19 #include "SkMessageBus.h" | 18 #include "SkMessageBus.h" |
20 #include "SkPaintPriv.h" | 19 #include "SkPaintPriv.h" |
21 #include "SkPathEffect.h" | 20 #include "SkPathEffect.h" |
22 #include "SkPicture.h" | 21 #include "SkPicture.h" |
23 #include "SkRegion.h" | 22 #include "SkRegion.h" |
24 #include "SkShader.h" | 23 #include "SkShader.h" |
25 #include "SkStream.h" | 24 #include "SkStream.h" |
26 #include "SkTDArray.h" | 25 #include "SkTDArray.h" |
27 #include "SkTLogic.h" | 26 #include "SkTLogic.h" |
28 #include "SkTSearch.h" | 27 #include "SkTSearch.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 int32_t id = sk_atomic_inc(&gNextID); | 302 int32_t id = sk_atomic_inc(&gNextID); |
304 if (id >= 1 << (8 * sizeof(Domain))) { | 303 if (id >= 1 << (8 * sizeof(Domain))) { |
305 SK_CRASH(); | 304 SK_CRASH(); |
306 } | 305 } |
307 | 306 |
308 return static_cast<Domain>(id); | 307 return static_cast<Domain>(id); |
309 } | 308 } |
310 | 309 |
311 /////////////////////////////////////////////////////////////////////////////// | 310 /////////////////////////////////////////////////////////////////////////////// |
312 | 311 |
313 void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) cons
t { | 312 void SkPicture::playback(SkCanvas* canvas, AbortCallback* callback) const { |
314 SkASSERT(canvas); | 313 SkASSERT(canvas); |
315 | 314 |
316 // If the query contains the whole picture, don't bother with the BBH. | 315 // If the query contains the whole picture, don't bother with the BBH. |
317 SkRect clipBounds = { 0, 0, 0, 0 }; | 316 SkRect clipBounds = { 0, 0, 0, 0 }; |
318 (void)canvas->getClipBounds(&clipBounds); | 317 (void)canvas->getClipBounds(&clipBounds); |
319 const bool useBBH = !clipBounds.contains(this->cullRect()); | 318 const bool useBBH = !clipBounds.contains(this->cullRect()); |
320 | 319 |
321 SkRecordDraw(*fRecord, canvas, this->drawablePicts(), NULL, this->drawableCo
unt(), | 320 SkRecordDraw(*fRecord, canvas, this->drawablePicts(), NULL, this->drawableCo
unt(), |
322 useBBH ? fBBH.get() : NULL, callback); | 321 useBBH ? fBBH.get() : NULL, callback); |
323 } | 322 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 497 |
499 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, | 498 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, |
500 SkBBoxHierarchy* bbh) | 499 SkBBoxHierarchy* bbh) |
501 : fUniqueID(next_picture_generation_id()) | 500 : fUniqueID(next_picture_generation_id()) |
502 , fCullRect(cullRect) | 501 , fCullRect(cullRect) |
503 , fRecord(SkRef(record)) | 502 , fRecord(SkRef(record)) |
504 , fBBH(SkSafeRef(bbh)) | 503 , fBBH(SkSafeRef(bbh)) |
505 , fDrawablePicts(drawablePicts) // take ownership | 504 , fDrawablePicts(drawablePicts) // take ownership |
506 , fAnalysis(*fRecord) | 505 , fAnalysis(*fRecord) |
507 {} | 506 {} |
OLD | NEW |