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" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 /////////////////////////////////////////////////////////////////////////////// | 312 /////////////////////////////////////////////////////////////////////////////// |
313 | 313 |
314 void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) cons
t { | 314 void SkPicture::playback(SkCanvas* canvas, SkDrawPictureCallback* callback) cons
t { |
315 SkASSERT(canvas); | 315 SkASSERT(canvas); |
316 | 316 |
317 // If the query contains the whole picture, don't bother with the BBH. | 317 // If the query contains the whole picture, don't bother with the BBH. |
318 SkRect clipBounds = { 0, 0, 0, 0 }; | 318 SkRect clipBounds = { 0, 0, 0, 0 }; |
319 (void)canvas->getClipBounds(&clipBounds); | 319 (void)canvas->getClipBounds(&clipBounds); |
320 const bool useBBH = !clipBounds.contains(this->cullRect()); | 320 const bool useBBH = !clipBounds.contains(this->cullRect()); |
321 | 321 |
322 SkRecordDraw(*fRecord, canvas, this->drawablePicts(), this->drawableCount(), | 322 SkRecordDraw(*fRecord, canvas, this->drawablePicts(), NULL, this->drawableCo
unt(), |
323 useBBH ? fBBH.get() : NULL, callback); | 323 useBBH ? fBBH.get() : NULL, callback); |
324 } | 324 } |
325 | 325 |
326 /////////////////////////////////////////////////////////////////////////////// | 326 /////////////////////////////////////////////////////////////////////////////// |
327 | 327 |
328 #include "SkStream.h" | 328 #include "SkStream.h" |
329 | 329 |
330 static const char kMagic[] = { 's', 'k', 'i', 'a', 'p', 'i', 'c', 't' }; | 330 static const char kMagic[] = { 's', 'k', 'i', 'a', 'p', 'i', 'c', 't' }; |
331 | 331 |
332 bool SkPicture::IsValidPictInfo(const SkPictInfo& info) { | 332 bool SkPicture::IsValidPictInfo(const SkPictInfo& info) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 if (8 == sizeof(void*)) { | 467 if (8 == sizeof(void*)) { |
468 info->fFlags |= SkPictInfo::kPtrIs64Bit_Flag; | 468 info->fFlags |= SkPictInfo::kPtrIs64Bit_Flag; |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 // This for compatibility with serialization code only. This is not cheap. | 472 // This for compatibility with serialization code only. This is not cheap. |
473 SkPictureData* SkPicture::Backport(const SkRecord& src, const SkPictInfo& info, | 473 SkPictureData* SkPicture::Backport(const SkRecord& src, const SkPictInfo& info, |
474 SkPicture const* const drawablePicts[], int d
rawableCount) { | 474 SkPicture const* const drawablePicts[], int d
rawableCount) { |
475 SkPictureRecord rec(SkISize::Make(info.fCullRect.width(), info.fCullRect.hei
ght()), 0/*flags*/); | 475 SkPictureRecord rec(SkISize::Make(info.fCullRect.width(), info.fCullRect.hei
ght()), 0/*flags*/); |
476 rec.beginRecording(); | 476 rec.beginRecording(); |
477 SkRecordDraw(src, &rec, drawablePicts, drawableCount, NULL/*bbh*/, NULL/
*callback*/); | 477 SkRecordDraw(src, &rec, drawablePicts, NULL, drawableCount, NULL/*bbh*/,
NULL/*callback*/); |
478 rec.endRecording(); | 478 rec.endRecording(); |
479 return SkNEW_ARGS(SkPictureData, (rec, info, false/*deep copy ops?*/)); | 479 return SkNEW_ARGS(SkPictureData, (rec, info, false/*deep copy ops?*/)); |
480 } | 480 } |
481 | 481 |
482 void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { | 482 void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { |
483 SkPictInfo info; | 483 SkPictInfo info; |
484 this->createHeader(&info); | 484 this->createHeader(&info); |
485 SkAutoTDelete<SkPictureData> data(Backport(*fRecord, info, this->drawablePic
ts(), | 485 SkAutoTDelete<SkPictureData> data(Backport(*fRecord, info, this->drawablePic
ts(), |
486 this->drawableCount())); | 486 this->drawableCount())); |
487 | 487 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 #endif | 519 #endif |
520 | 520 |
521 bool SkPicture::hasText() const { return fAnalysis.fHasText; } | 521 bool SkPicture::hasText() const { return fAnalysis.fHasText; } |
522 bool SkPicture::willPlayBackBitmaps() const { return fAnalysis.fWillPlaybackBitm
aps; } | 522 bool SkPicture::willPlayBackBitmaps() const { return fAnalysis.fWillPlaybackBitm
aps; } |
523 int SkPicture::approximateOpCount() const { return fRecord->count(); } | 523 int SkPicture::approximateOpCount() const { return fRecord->count(); } |
524 | 524 |
525 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, | 525 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, |
526 SkBBoxHierarchy* bbh) | 526 SkBBoxHierarchy* bbh) |
527 : fUniqueID(next_picture_generation_id()) | 527 : fUniqueID(next_picture_generation_id()) |
528 , fCullRect(cullRect) | 528 , fCullRect(cullRect) |
529 , fRecord(record) | 529 , fRecord(SkRef(record)) |
530 , fBBH(SkSafeRef(bbh)) | 530 , fBBH(SkSafeRef(bbh)) |
531 , fDrawablePicts(drawablePicts) | 531 , fDrawablePicts(drawablePicts) // take ownership |
532 , fAnalysis(*fRecord) | 532 , fAnalysis(*fRecord) |
533 {} | 533 {} |
OLD | NEW |