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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 * src and dst may be the same path. | 92 * src and dst may be the same path. |
93 */ | 93 */ |
94 bool applyToPath(SkPath* dst, const SkPath& src) const; | 94 bool applyToPath(SkPath* dst, const SkPath& src) const; |
95 | 95 |
96 /** | 96 /** |
97 * Apply these stroke parameters to a paint. | 97 * Apply these stroke parameters to a paint. |
98 */ | 98 */ |
99 void applyToPaint(SkPaint* paint) const; | 99 void applyToPaint(SkPaint* paint) const; |
100 | 100 |
101 /** | 101 /** |
| 102 * Gives a conservative value for the outset that should applied to a |
| 103 * geometries bounds to account for any inflation due to applying this |
| 104 * strokeRec to the geometry. |
| 105 */ |
| 106 SkScalar getInflationRadius() const; |
| 107 |
| 108 /** |
| 109 * Equivalent to: |
| 110 * SkStrokeRec rec(paint, style); |
| 111 * rec.getInflationRadius(); |
| 112 * This does not account for other effects on the paint (i.e. path |
| 113 * effect). |
| 114 */ |
| 115 static SkScalar GetInflationRadius(const SkPaint&, SkPaint::Style); |
| 116 |
| 117 /** |
102 * Compare if two SkStrokeRecs have an equal effect on a path. | 118 * Compare if two SkStrokeRecs have an equal effect on a path. |
103 * Equal SkStrokeRecs produce equal paths. Equality of produced | 119 * Equal SkStrokeRecs produce equal paths. Equality of produced |
104 * paths does not take the ResScale parameter into account. | 120 * paths does not take the ResScale parameter into account. |
105 */ | 121 */ |
106 bool hasEqualEffect(const SkStrokeRec& other) const { | 122 bool hasEqualEffect(const SkStrokeRec& other) const { |
107 if (!this->needToApply()) { | 123 if (!this->needToApply()) { |
108 return this->getStyle() == other.getStyle(); | 124 return this->getStyle() == other.getStyle(); |
109 } | 125 } |
110 return fWidth == other.fWidth && | 126 return fWidth == other.fWidth && |
111 fMiterLimit == other.fMiterLimit && | 127 fMiterLimit == other.fMiterLimit && |
(...skipping 14 matching lines...) Expand all Loading... |
126 // | 142 // |
127 // fCap and fJoin are larger than needed to avoid having to initialize | 143 // fCap and fJoin are larger than needed to avoid having to initialize |
128 // any pad values | 144 // any pad values |
129 uint32_t fCap : 16; // SkPaint::Cap | 145 uint32_t fCap : 16; // SkPaint::Cap |
130 uint32_t fJoin : 15; // SkPaint::Join | 146 uint32_t fJoin : 15; // SkPaint::Join |
131 uint32_t fStrokeAndFill : 1; // bool | 147 uint32_t fStrokeAndFill : 1; // bool |
132 }; | 148 }; |
133 SK_END_REQUIRE_DENSE | 149 SK_END_REQUIRE_DENSE |
134 | 150 |
135 #endif | 151 #endif |
OLD | NEW |