| 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 "SkTSearch.h" | 9 #include "SkTSearch.h" |
| 10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 return offset; | 856 return offset; |
| 857 } | 857 } |
| 858 | 858 |
| 859 void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdg
eStyle edgeStyle) { | 859 void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdg
eStyle edgeStyle) { |
| 860 | 860 |
| 861 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 861 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 862 fMCMgr.clipRRect(rrect, op, doAA); | 862 fMCMgr.clipRRect(rrect, op, doAA); |
| 863 #else | 863 #else |
| 864 this->recordClipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); | 864 this->recordClipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); |
| 865 #endif | 865 #endif |
| 866 if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) { | 866 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); |
| 867 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); | |
| 868 } else { | |
| 869 this->INHERITED::onClipRRect(rrect, op, edgeStyle); | |
| 870 } | |
| 871 } | 867 } |
| 872 | 868 |
| 873 size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkRegion::Op op, b
ool doAA) { | 869 size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkRegion::Op op, b
ool doAA) { |
| 874 // op + rrect + clip params | 870 // op + rrect + clip params |
| 875 size_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size; | 871 size_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size; |
| 876 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 872 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 877 size += kUInt32Size; // + restore offset | 873 size += kUInt32Size; // + restore offset |
| 878 #else | 874 #else |
| 879 // recordRestoreOffsetPlaceholder doesn't always write an offset | 875 // recordRestoreOffsetPlaceholder doesn't always write an offset |
| 880 if (!fRestoreOffsetStack.isEmpty()) { | 876 if (!fRestoreOffsetStack.isEmpty()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 892 | 888 |
| 893 void SkPictureRecord::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeSt
yle edgeStyle) { | 889 void SkPictureRecord::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeSt
yle edgeStyle) { |
| 894 | 890 |
| 895 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 891 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 896 fMCMgr.clipPath(path, op, doAA); | 892 fMCMgr.clipPath(path, op, doAA); |
| 897 #else | 893 #else |
| 898 int pathID = this->addPathToHeap(path); | 894 int pathID = this->addPathToHeap(path); |
| 899 this->recordClipPath(pathID, op, kSoft_ClipEdgeStyle == edgeStyle); | 895 this->recordClipPath(pathID, op, kSoft_ClipEdgeStyle == edgeStyle); |
| 900 #endif | 896 #endif |
| 901 | 897 |
| 902 if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) { | 898 this->updateClipConservativelyUsingBounds(path.getBounds(), op, |
| 903 this->updateClipConservativelyUsingBounds(path.getBounds(), op, | 899 path.isInverseFillType()); |
| 904 path.isInverseFillType()); | |
| 905 } else { | |
| 906 this->INHERITED::onClipPath(path, op, edgeStyle); | |
| 907 } | |
| 908 } | 900 } |
| 909 | 901 |
| 910 size_t SkPictureRecord::recordClipPath(int pathID, SkRegion::Op op, bool doAA) { | 902 size_t SkPictureRecord::recordClipPath(int pathID, SkRegion::Op op, bool doAA) { |
| 911 // op + path index + clip params | 903 // op + path index + clip params |
| 912 size_t size = 3 * kUInt32Size; | 904 size_t size = 3 * kUInt32Size; |
| 913 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 905 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 914 size += kUInt32Size; // + restore offset | 906 size += kUInt32Size; // + restore offset |
| 915 #else | 907 #else |
| 916 // recordRestoreOffsetPlaceholder doesn't always write an offset | 908 // recordRestoreOffsetPlaceholder doesn't always write an offset |
| 917 if (!fRestoreOffsetStack.isEmpty()) { | 909 if (!fRestoreOffsetStack.isEmpty()) { |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 void SkPictureRecord::validateRegions() const { | 1818 void SkPictureRecord::validateRegions() const { |
| 1827 int count = fRegions.count(); | 1819 int count = fRegions.count(); |
| 1828 SkASSERT((unsigned) count < 0x1000); | 1820 SkASSERT((unsigned) count < 0x1000); |
| 1829 for (int index = 0; index < count; index++) { | 1821 for (int index = 0; index < count; index++) { |
| 1830 const SkFlatData* region = fRegions[index]; | 1822 const SkFlatData* region = fRegions[index]; |
| 1831 SkASSERT(region); | 1823 SkASSERT(region); |
| 1832 // region->validate(); | 1824 // region->validate(); |
| 1833 } | 1825 } |
| 1834 } | 1826 } |
| 1835 #endif | 1827 #endif |
| OLD | NEW |