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" |
11 | 11 |
12 static inline int is_even(int x) { | 12 static inline int is_even(int x) { |
13 return (~x) << 31; | 13 return !(x & 1); |
14 } | 14 } |
15 | 15 |
16 static SkScalar find_first_interval(const SkScalar intervals[], SkScalar phase, | 16 static SkScalar find_first_interval(const SkScalar intervals[], SkScalar phase, |
17 int32_t* index, int count) { | 17 int32_t* index, int count) { |
18 for (int i = 0; i < count; ++i) { | 18 for (int i = 0; i < count; ++i) { |
19 if (phase > intervals[i]) { | 19 if (phase > intervals[i]) { |
20 phase -= intervals[i]; | 20 phase -= intervals[i]; |
21 } else { | 21 } else { |
22 *index = i; | 22 *index = i; |
23 return intervals[i] - phase; | 23 return intervals[i] - phase; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 bool SkDashPath::FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec
, | 321 bool SkDashPath::FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec
, |
322 const SkRect* cullRect, const SkPathEffect::Dash
Info& info) { | 322 const SkRect* cullRect, const SkPathEffect::Dash
Info& info) { |
323 SkScalar initialDashLength = 0; | 323 SkScalar initialDashLength = 0; |
324 int32_t initialDashIndex = 0; | 324 int32_t initialDashIndex = 0; |
325 SkScalar intervalLength = 0; | 325 SkScalar intervalLength = 0; |
326 CalcDashParameters(info.fPhase, info.fIntervals, info.fCount, | 326 CalcDashParameters(info.fPhase, info.fIntervals, info.fCount, |
327 &initialDashLength, &initialDashIndex, &intervalLength); | 327 &initialDashLength, &initialDashIndex, &intervalLength); |
328 return FilterDashPath(dst, src, rec, cullRect, info.fIntervals, info.fCount,
initialDashLength, | 328 return FilterDashPath(dst, src, rec, cullRect, info.fIntervals, info.fCount,
initialDashLength, |
329 initialDashIndex, intervalLength); | 329 initialDashIndex, intervalLength); |
330 } | 330 } |
OLD | NEW |