OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef SkStrokeRec_DEFINED | 8 #ifndef SkStrokeRec_DEFINED |
9 #define SkStrokeRec_DEFINED | 9 #define SkStrokeRec_DEFINED |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 * | 88 * |
89 * src and dst may be the same path. | 89 * src and dst may be the same path. |
90 */ | 90 */ |
91 bool applyToPath(SkPath* dst, const SkPath& src) const; | 91 bool applyToPath(SkPath* dst, const SkPath& src) const; |
92 | 92 |
93 /** | 93 /** |
94 * Apply these stroke parameters to a paint. | 94 * Apply these stroke parameters to a paint. |
95 */ | 95 */ |
96 void applyToPaint(SkPaint* paint) const; | 96 void applyToPaint(SkPaint* paint) const; |
97 | 97 |
98 bool operator==(const SkStrokeRec& other) const { | 98 /** |
99 return fWidth == other.fWidth && | 99 * Compare if two SkStrokeRecs have an equal effect on a path. |
100 fMiterLimit == other.fMiterLimit && | 100 * Equal SkStrokeRecs produce equal paths. Equality of produced |
101 fCap == other.fCap && | 101 * paths does not take the ResScale parameter into account. |
102 fJoin == other.fJoin && | 102 */ |
103 fStrokeAndFill == other.fStrokeAndFill; | 103 bool hasEqualEffect(const SkStrokeRec& other) const { |
| 104 if (!this->needToApply()) { |
| 105 return this->getStyle() == other.getStyle(); |
| 106 } |
| 107 return fWidth == other.fWidth && |
| 108 fMiterLimit == other.fMiterLimit && |
| 109 fCap == other.fCap && |
| 110 fJoin == other.fJoin && |
| 111 fStrokeAndFill == other.fStrokeAndFill; |
104 } | 112 } |
105 | 113 |
106 private: | 114 private: |
107 void init(const SkPaint&, SkPaint::Style, SkScalar resScale); | 115 void init(const SkPaint&, SkPaint::Style, SkScalar resScale); |
108 | 116 |
109 SkScalar fResScale; | 117 SkScalar fResScale; |
110 SkScalar fWidth; | 118 SkScalar fWidth; |
111 SkScalar fMiterLimit; | 119 SkScalar fMiterLimit; |
112 SkPaint::Cap fCap; | 120 SkPaint::Cap fCap; |
113 SkPaint::Join fJoin; | 121 SkPaint::Join fJoin; |
114 bool fStrokeAndFill; | 122 bool fStrokeAndFill; |
115 }; | 123 }; |
116 | 124 |
117 #endif | 125 #endif |
OLD | NEW |