| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 } | 618 } |
| 619 | 619 |
| 620 // fRecord OK | 620 // fRecord OK |
| 621 uint32_t SkPicture::uniqueID() const { | 621 uint32_t SkPicture::uniqueID() const { |
| 622 if (SK_InvalidGenID == fUniqueID) { | 622 if (SK_InvalidGenID == fUniqueID) { |
| 623 fUniqueID = next_picture_generation_id(); | 623 fUniqueID = next_picture_generation_id(); |
| 624 } | 624 } |
| 625 return fUniqueID; | 625 return fUniqueID; |
| 626 } | 626 } |
| 627 | 627 |
| 628 | |
| 629 static SkRecord* optimized(SkRecord* r) { | |
| 630 SkRecordOptimize(r); | |
| 631 return r; | |
| 632 } | |
| 633 | |
| 634 // fRecord OK | 628 // fRecord OK |
| 635 SkPicture::SkPicture(SkScalar width, SkScalar height, SkRecord* record, SkBBoxHi
erarchy* bbh) | 629 SkPicture::SkPicture(SkScalar width, SkScalar height, SkRecord* record, SkBBoxHi
erarchy* bbh) |
| 636 : fCullWidth(width) | 630 : fCullWidth(width) |
| 637 , fCullHeight(height) | 631 , fCullHeight(height) |
| 638 , fRecord(optimized(record)) | 632 , fRecord(record) |
| 639 , fBBH(SkSafeRef(bbh)) | 633 , fBBH(SkSafeRef(bbh)) |
| 640 , fAnalysis(*fRecord) { | 634 , fAnalysis(*fRecord) { |
| 641 // TODO: delay as much of this work until just before first playback? | |
| 642 if (fBBH.get()) { | |
| 643 SkRecordFillBounds(this->cullRect(), *fRecord, fBBH.get()); | |
| 644 } | |
| 645 this->needsNewGenID(); | 635 this->needsNewGenID(); |
| 646 } | 636 } |
| 647 | 637 |
| 648 // Note that we are assuming that this entry point will only be called from | 638 // Note that we are assuming that this entry point will only be called from |
| 649 // one thread. Currently the only client of this method is | 639 // one thread. Currently the only client of this method is |
| 650 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single | 640 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single |
| 651 // thread. | 641 // thread. |
| 652 void SkPicture::addDeletionListener(DeletionListener* listener) const { | 642 void SkPicture::addDeletionListener(DeletionListener* listener) const { |
| 653 SkASSERT(listener); | 643 SkASSERT(listener); |
| 654 | 644 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 667 int SkPicture::approximateOpCount() const { | 657 int SkPicture::approximateOpCount() const { |
| 668 SkASSERT(fRecord.get() || fData.get()); | 658 SkASSERT(fRecord.get() || fData.get()); |
| 669 if (fRecord.get()) { | 659 if (fRecord.get()) { |
| 670 return fRecord->count(); | 660 return fRecord->count(); |
| 671 } | 661 } |
| 672 if (fData.get()) { | 662 if (fData.get()) { |
| 673 return fData->opCount(); | 663 return fData->opCount(); |
| 674 } | 664 } |
| 675 return 0; | 665 return 0; |
| 676 } | 666 } |
| OLD | NEW |