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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 return genID; | 523 return genID; |
524 } | 524 } |
525 | 525 |
526 uint32_t SkPicture::uniqueID() const { | 526 uint32_t SkPicture::uniqueID() const { |
527 if (SK_InvalidGenID == fUniqueID) { | 527 if (SK_InvalidGenID == fUniqueID) { |
528 fUniqueID = next_picture_generation_id(); | 528 fUniqueID = next_picture_generation_id(); |
529 } | 529 } |
530 return fUniqueID; | 530 return fUniqueID; |
531 } | 531 } |
532 | 532 |
533 SkPicture::SkPicture(SkScalar width, SkScalar height, SkRecord* record, SkData*
drawablePicts, | 533 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SkData* drawableP
icts, |
534 SkBBoxHierarchy* bbh) | 534 SkBBoxHierarchy* bbh) |
535 : fCullWidth(width) | 535 : fCullRect(cullRect) |
536 , fCullHeight(height) | |
537 , fRecord(record) | 536 , fRecord(record) |
538 , fBBH(SkSafeRef(bbh)) | 537 , fBBH(SkSafeRef(bbh)) |
539 , fDrawablePicts(SkSafeRef(drawablePicts)) | 538 , fDrawablePicts(SkSafeRef(drawablePicts)) |
540 , fAnalysis(*fRecord) { | 539 , fAnalysis(*fRecord) { |
541 this->needsNewGenID(); | 540 this->needsNewGenID(); |
542 } | 541 } |
543 | 542 |
544 // Note that we are assuming that this entry point will only be called from | 543 // Note that we are assuming that this entry point will only be called from |
545 // one thread. Currently the only client of this method is | 544 // one thread. Currently the only client of this method is |
546 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single | 545 // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single |
547 // thread. | 546 // thread. |
548 void SkPicture::addDeletionListener(DeletionListener* listener) const { | 547 void SkPicture::addDeletionListener(DeletionListener* listener) const { |
549 SkASSERT(listener); | 548 SkASSERT(listener); |
550 | 549 |
551 *fDeletionListeners.append() = SkRef(listener); | 550 *fDeletionListeners.append() = SkRef(listener); |
552 } | 551 } |
553 | 552 |
554 void SkPicture::callDeletionListeners() { | 553 void SkPicture::callDeletionListeners() { |
555 for (int i = 0; i < fDeletionListeners.count(); ++i) { | 554 for (int i = 0; i < fDeletionListeners.count(); ++i) { |
556 fDeletionListeners[i]->onDeletion(this->uniqueID()); | 555 fDeletionListeners[i]->onDeletion(this->uniqueID()); |
557 } | 556 } |
558 | 557 |
559 fDeletionListeners.unrefAll(); | 558 fDeletionListeners.unrefAll(); |
560 } | 559 } |
OLD | NEW |