OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkDashPathPriv.h" | 8 #include "SkDashPathPriv.h" |
9 #include "SkPathMeasure.h" | 9 #include "SkPathMeasure.h" |
10 #include "SkStrokeRec.h" | 10 #include "SkStrokeRec.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 SkScalar fPathLength; | 212 SkScalar fPathLength; |
213 }; | 213 }; |
214 | 214 |
215 | 215 |
216 bool SkDashPath::InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec
, | 216 bool SkDashPath::InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec
, |
217 const SkRect* cullRect, const SkScalar aInterval
s[], | 217 const SkRect* cullRect, const SkScalar aInterval
s[], |
218 int32_t count, SkScalar initialDashLength, int32
_t initialDashIndex, | 218 int32_t count, SkScalar initialDashLength, int32
_t initialDashIndex, |
219 SkScalar intervalLength) { | 219 SkScalar intervalLength) { |
220 | 220 |
221 // we do nothing if the src wants to be filled | 221 // we do nothing if the src wants to be filled |
222 if (rec->isFillStyle()) { | 222 SkStrokeRec::Style style = rec->getStyle(); |
| 223 if (SkStrokeRec::kFill_Style == style || SkStrokeRec::kStrokeAndFill_Style =
= style) { |
223 return false; | 224 return false; |
224 } | 225 } |
225 | 226 |
226 const SkScalar* intervals = aIntervals; | 227 const SkScalar* intervals = aIntervals; |
227 SkScalar dashCount = 0; | 228 SkScalar dashCount = 0; |
228 int segCount = 0; | 229 int segCount = 0; |
229 | 230 |
230 SkPath cullPathStorage; | 231 SkPath cullPathStorage; |
231 const SkPath* srcPtr = &src; | 232 const SkPath* srcPtr = &src; |
232 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) { | 233 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 SkScalar length = 0; | 334 SkScalar length = 0; |
334 for (int i = 0; i < count; i++) { | 335 for (int i = 0; i < count; i++) { |
335 if (intervals[i] < 0) { | 336 if (intervals[i] < 0) { |
336 return false; | 337 return false; |
337 } | 338 } |
338 length += intervals[i]; | 339 length += intervals[i]; |
339 } | 340 } |
340 // watch out for values that might make us go out of bounds | 341 // watch out for values that might make us go out of bounds |
341 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length); | 342 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length); |
342 } | 343 } |
OLD | NEW |