OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #include "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
9 #include "SkBBoxHierarchy.h" | 9 #include "SkBBoxHierarchy.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 this->addRect(rect); | 781 this->addRect(rect); |
782 this->addInt(ClipParams_pack(op, doAA)); | 782 this->addInt(ClipParams_pack(op, doAA)); |
783 size_t offset = this->recordRestoreOffsetPlaceholder(op); | 783 size_t offset = this->recordRestoreOffsetPlaceholder(op); |
784 | 784 |
785 this->validate(initialOffset, size); | 785 this->validate(initialOffset, size); |
786 return offset; | 786 return offset; |
787 } | 787 } |
788 | 788 |
789 void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdg
eStyle edgeStyle) { | 789 void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdg
eStyle edgeStyle) { |
790 this->recordClipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); | 790 this->recordClipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); |
791 this->INHERITED::onClipRRect(rrect, op, edgeStyle); | 791 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); |
792 } | 792 } |
793 | 793 |
794 size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkRegion::Op op, b
ool doAA) { | 794 size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkRegion::Op op, b
ool doAA) { |
795 // op + rrect + clip params | 795 // op + rrect + clip params |
796 size_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size; | 796 size_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size; |
797 // recordRestoreOffsetPlaceholder doesn't always write an offset | 797 // recordRestoreOffsetPlaceholder doesn't always write an offset |
798 if (!fRestoreOffsetStack.isEmpty()) { | 798 if (!fRestoreOffsetStack.isEmpty()) { |
799 // + restore offset | 799 // + restore offset |
800 size += kUInt32Size; | 800 size += kUInt32Size; |
801 } | 801 } |
802 size_t initialOffset = this->addDraw(CLIP_RRECT, &size); | 802 size_t initialOffset = this->addDraw(CLIP_RRECT, &size); |
803 this->addRRect(rrect); | 803 this->addRRect(rrect); |
804 this->addInt(ClipParams_pack(op, doAA)); | 804 this->addInt(ClipParams_pack(op, doAA)); |
805 size_t offset = recordRestoreOffsetPlaceholder(op); | 805 size_t offset = recordRestoreOffsetPlaceholder(op); |
806 this->validate(initialOffset, size); | 806 this->validate(initialOffset, size); |
807 return offset; | 807 return offset; |
808 } | 808 } |
809 | 809 |
810 void SkPictureRecord::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeSt
yle edgeStyle) { | 810 void SkPictureRecord::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeSt
yle edgeStyle) { |
811 int pathID = this->addPathToHeap(path); | 811 int pathID = this->addPathToHeap(path); |
812 this->recordClipPath(pathID, op, kSoft_ClipEdgeStyle == edgeStyle); | 812 this->recordClipPath(pathID, op, kSoft_ClipEdgeStyle == edgeStyle); |
813 this->INHERITED::onClipPath(path, op, edgeStyle); | 813 |
| 814 this->updateClipConservativelyUsingBounds(path.getBounds(), op, |
| 815 path.isInverseFillType()); |
814 } | 816 } |
815 | 817 |
816 size_t SkPictureRecord::recordClipPath(int pathID, SkRegion::Op op, bool doAA) { | 818 size_t SkPictureRecord::recordClipPath(int pathID, SkRegion::Op op, bool doAA) { |
817 // op + path index + clip params | 819 // op + path index + clip params |
818 size_t size = 3 * kUInt32Size; | 820 size_t size = 3 * kUInt32Size; |
819 // recordRestoreOffsetPlaceholder doesn't always write an offset | 821 // recordRestoreOffsetPlaceholder doesn't always write an offset |
820 if (!fRestoreOffsetStack.isEmpty()) { | 822 if (!fRestoreOffsetStack.isEmpty()) { |
821 // + restore offset | 823 // + restore offset |
822 size += kUInt32Size; | 824 size += kUInt32Size; |
823 } | 825 } |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1546 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
1545 int index = fTextBlobRefs.count(); | 1547 int index = fTextBlobRefs.count(); |
1546 *fTextBlobRefs.append() = blob; | 1548 *fTextBlobRefs.append() = blob; |
1547 blob->ref(); | 1549 blob->ref(); |
1548 // follow the convention of recording a 1-based index | 1550 // follow the convention of recording a 1-based index |
1549 this->addInt(index + 1); | 1551 this->addInt(index + 1); |
1550 } | 1552 } |
1551 | 1553 |
1552 /////////////////////////////////////////////////////////////////////////////// | 1554 /////////////////////////////////////////////////////////////////////////////// |
1553 | 1555 |
OLD | NEW |