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