OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 #ifndef SkPath_DEFINED | 10 #ifndef SkPath_DEFINED |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 /** Returns true if the path is an oval. | 144 /** Returns true if the path is an oval. |
145 * | 145 * |
146 * @param rect returns the bounding rect of this oval. It's a circle | 146 * @param rect returns the bounding rect of this oval. It's a circle |
147 * if the height and width are the same. | 147 * if the height and width are the same. |
148 * | 148 * |
149 * @return true if this path is an oval. | 149 * @return true if this path is an oval. |
150 * Tracking whether a path is an oval is considered an | 150 * Tracking whether a path is an oval is considered an |
151 * optimization for performance and so some paths that are in | 151 * optimization for performance and so some paths that are in |
152 * fact ovals can report false. | 152 * fact ovals can report false. |
153 */ | 153 */ |
154 bool isOval(SkRect* rect) const; | 154 bool isOval(SkRect* rect) const { return fPathRef->isOval(rect); } |
155 | 155 |
156 /** Clear any lines and curves from the path, making it empty. This frees up | 156 /** Clear any lines and curves from the path, making it empty. This frees up |
157 internal storage associated with those segments. | 157 internal storage associated with those segments. |
158 On Android, does not change fSourcePath. | 158 On Android, does not change fSourcePath. |
159 */ | 159 */ |
160 void reset(); | 160 void reset(); |
161 | 161 |
162 /** Similar to reset(), in that all lines and curves are removed from the | 162 /** Similar to reset(), in that all lines and curves are removed from the |
163 path. However, any internal storage for those lines/curves is retained, | 163 path. However, any internal storage for those lines/curves is retained, |
164 making reuse of the path potentially faster. | 164 making reuse of the path potentially faster. |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 const SkPath* getSourcePath() const; | 924 const SkPath* getSourcePath() const; |
925 void setSourcePath(const SkPath* path); | 925 void setSourcePath(const SkPath* path); |
926 #else | 926 #else |
927 static const int kPathRefGenIDBitCnt = 32; | 927 static const int kPathRefGenIDBitCnt = 32; |
928 #endif | 928 #endif |
929 | 929 |
930 SkDEBUGCODE(void validate() const;) | 930 SkDEBUGCODE(void validate() const;) |
931 | 931 |
932 private: | 932 private: |
933 enum SerializationOffsets { | 933 enum SerializationOffsets { |
| 934 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O |
| 935 kNewFormat2_SerializationShift = 29, // requires 1 bit |
| 936 #endif |
934 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O | 937 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O |
935 kNewFormat_SerializationShift = 28, // requires 1 bit | 938 kNewFormat_SerializationShift = 28, // requires 1 bit |
936 #endif | 939 #endif |
937 kDirection_SerializationShift = 26, // requires 2 bits | 940 kDirection_SerializationShift = 26, // requires 2 bits |
938 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O | 941 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O |
939 // rename to kUnused_SerializationShift | 942 // rename to kUnused_SerializationShift |
940 kOldIsFinite_SerializationShift = 25, // 1 bit | 943 kOldIsFinite_SerializationShift = 25, // 1 bit |
941 #endif | 944 #endif |
942 kIsOval_SerializationShift = 24, // requires 1 bit | 945 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O |
| 946 kOldIsOval_SerializationShift = 24, // requires 1 bit |
| 947 #endif |
943 kConvexity_SerializationShift = 16, // requires 8 bits | 948 kConvexity_SerializationShift = 16, // requires 8 bits |
944 kFillType_SerializationShift = 8, // requires 8 bits | 949 kFillType_SerializationShift = 8, // requires 8 bits |
945 kSegmentMask_SerializationShift = 0 // requires 4 bits | 950 kSegmentMask_SerializationShift = 0 // requires 4 bits |
946 }; | 951 }; |
947 | 952 |
948 SkAutoTUnref<SkPathRef> fPathRef; | 953 SkAutoTUnref<SkPathRef> fPathRef; |
949 | 954 |
950 int fLastMoveToIndex; | 955 int fLastMoveToIndex; |
951 uint8_t fFillType; | 956 uint8_t fFillType; |
952 uint8_t fSegmentMask; | 957 uint8_t fSegmentMask; |
953 mutable uint8_t fConvexity; | 958 mutable uint8_t fConvexity; |
954 mutable uint8_t fDirection; | 959 mutable uint8_t fDirection; |
955 mutable SkBool8 fIsOval; | |
956 #ifdef SK_BUILD_FOR_ANDROID | 960 #ifdef SK_BUILD_FOR_ANDROID |
957 const SkPath* fSourcePath; | 961 const SkPath* fSourcePath; |
958 #endif | 962 #endif |
959 | 963 |
960 /** Resets all fields other than fPathRef to their initial 'empty' values. | 964 /** Resets all fields other than fPathRef to their initial 'empty' values. |
961 * Assumes the caller has already emptied fPathRef. | 965 * Assumes the caller has already emptied fPathRef. |
962 * On Android increments fGenerationID without reseting it. | 966 * On Android increments fGenerationID without reseting it. |
963 */ | 967 */ |
964 void resetFields(); | 968 void resetFields(); |
965 | 969 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 SkDEBUGCODE(this->validate();) | 1005 SkDEBUGCODE(this->validate();) |
1002 return fPathRef->hasComputedBounds(); | 1006 return fPathRef->hasComputedBounds(); |
1003 } | 1007 } |
1004 | 1008 |
1005 | 1009 |
1006 // 'rect' needs to be sorted | 1010 // 'rect' needs to be sorted |
1007 void setBounds(const SkRect& rect) { | 1011 void setBounds(const SkRect& rect) { |
1008 fPathRef->setBounds(rect); | 1012 fPathRef->setBounds(rect); |
1009 } | 1013 } |
1010 | 1014 |
1011 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O | 1015 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O |
1012 friend class SkPathRef; // just for SerializationOffsets | 1016 friend class SkPathRef; // just for SerializationOffsets |
1013 #endif | 1017 #endif |
1014 friend class SkAutoPathBoundsUpdate; | 1018 friend class SkAutoPathBoundsUpdate; |
1015 friend class SkAutoDisableOvalCheck; | 1019 friend class SkAutoDisableOvalCheck; |
1016 friend class SkAutoDisableDirectionCheck; | 1020 friend class SkAutoDisableDirectionCheck; |
1017 friend class SkBench_AddPathTest; // perf test reversePathTo | 1021 friend class SkBench_AddPathTest; // perf test reversePathTo |
1018 friend class PathTest_Private; // unit test reversePathTo | 1022 friend class PathTest_Private; // unit test reversePathTo |
1019 }; | 1023 }; |
1020 | 1024 |
1021 #endif | 1025 #endif |
OLD | NEW |