| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 radius = SkScalarMul(radius, rec.getMiter()); | 85 radius = SkScalarMul(radius, rec.getMiter()); |
| 86 } | 86 } |
| 87 rect->outset(radius, radius); | 87 rect->outset(radius, radius); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Only handles lines for now. If returns true, dstPath is the new (smaller) | 90 // Only handles lines for now. If returns true, dstPath is the new (smaller) |
| 91 // path. If returns false, then dstPath parameter is ignored. | 91 // path. If returns false, then dstPath parameter is ignored. |
| 92 static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec, | 92 static bool cull_path(const SkPath& srcPath, const SkStrokeRec& rec, |
| 93 const SkRect* cullRect, SkScalar intervalLength, | 93 const SkRect* cullRect, SkScalar intervalLength, |
| 94 SkPath* dstPath) { | 94 SkPath* dstPath) { |
| 95 if (NULL == cullRect) { | 95 if (nullptr == cullRect) { |
| 96 return false; | 96 return false; |
| 97 } | 97 } |
| 98 | 98 |
| 99 SkPoint pts[2]; | 99 SkPoint pts[2]; |
| 100 if (!srcPath.isLine(pts)) { | 100 if (!srcPath.isLine(pts)) { |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 SkRect bounds = *cullRect; | 104 SkRect bounds = *cullRect; |
| 105 outset_for_stroke(&bounds, rec); | 105 outset_for_stroke(&bounds, rec); |
| (...skipping 214 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 |