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 | 10 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 | 266 |
267 // Using double precision to avoid looping indefinitely due to single pr
ecision rounding | 267 // Using double precision to avoid looping indefinitely due to single pr
ecision rounding |
268 // (for extreme path_length/dash_length ratios). See test_infinite_dash(
) unittest. | 268 // (for extreme path_length/dash_length ratios). See test_infinite_dash(
) unittest. |
269 double distance = 0; | 269 double distance = 0; |
270 double dlen = initialDashLength; | 270 double dlen = initialDashLength; |
271 | 271 |
272 while (distance < length) { | 272 while (distance < length) { |
273 SkASSERT(dlen >= 0); | 273 SkASSERT(dlen >= 0); |
274 addedSegment = false; | 274 addedSegment = false; |
275 if (is_even(index) && dlen > 0 && !skipFirstSegment) { | 275 if (is_even(index) && !skipFirstSegment) { |
276 addedSegment = true; | 276 addedSegment = true; |
277 ++segCount; | 277 ++segCount; |
278 | 278 |
279 if (specialLine) { | 279 if (specialLine) { |
280 lineRec.addSegment(SkDoubleToScalar(distance), | 280 lineRec.addSegment(SkDoubleToScalar(distance), |
281 SkDoubleToScalar(distance + dlen), | 281 SkDoubleToScalar(distance + dlen), |
282 dst); | 282 dst); |
283 } else { | 283 } else { |
284 meas.getSegment(SkDoubleToScalar(distance), | 284 meas.getSegment(SkDoubleToScalar(distance), |
285 SkDoubleToScalar(distance + dlen), | 285 SkDoubleToScalar(distance + dlen), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 bool SkDashPath::FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec
, | 320 bool SkDashPath::FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec
, |
321 const SkRect* cullRect, const SkPathEffect::Dash
Info& info) { | 321 const SkRect* cullRect, const SkPathEffect::Dash
Info& info) { |
322 SkScalar initialDashLength = 0; | 322 SkScalar initialDashLength = 0; |
323 int32_t initialDashIndex = 0; | 323 int32_t initialDashIndex = 0; |
324 SkScalar intervalLength = 0; | 324 SkScalar intervalLength = 0; |
325 CalcDashParameters(info.fPhase, info.fIntervals, info.fCount, | 325 CalcDashParameters(info.fPhase, info.fIntervals, info.fCount, |
326 &initialDashLength, &initialDashIndex, &intervalLength); | 326 &initialDashLength, &initialDashIndex, &intervalLength); |
327 return FilterDashPath(dst, src, rec, cullRect, info.fIntervals, info.fCount,
initialDashLength, | 327 return FilterDashPath(dst, src, rec, cullRect, info.fIntervals, info.fCount,
initialDashLength, |
328 initialDashIndex, intervalLength); | 328 initialDashIndex, intervalLength); |
329 } | 329 } |
OLD | NEW |