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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 SkPath cullPathStorage; | 236 SkPath cullPathStorage; |
237 const SkPath* srcPtr = &src; | 237 const SkPath* srcPtr = &src; |
238 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) { | 238 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) { |
239 srcPtr = &cullPathStorage; | 239 srcPtr = &cullPathStorage; |
240 } | 240 } |
241 | 241 |
242 SpecialLineRec lineRec; | 242 SpecialLineRec lineRec; |
243 bool specialLine = lineRec.init(*srcPtr, dst, rec, count >> 1, intervalLengt
h); | 243 bool specialLine = lineRec.init(*srcPtr, dst, rec, count >> 1, intervalLengt
h); |
244 | 244 |
245 SkPathMeasure meas(*srcPtr, false); | 245 SkPathMeasure meas(*srcPtr, false, rec->getResScale()); |
246 | 246 |
247 do { | 247 do { |
248 bool skipFirstSegment = meas.isClosed(); | 248 bool skipFirstSegment = meas.isClosed(); |
249 bool addedSegment = false; | 249 bool addedSegment = false; |
250 SkScalar length = meas.getLength(); | 250 SkScalar length = meas.getLength(); |
251 int index = initialDashIndex; | 251 int index = initialDashIndex; |
252 | 252 |
253 // Since the path length / dash length ratio may be arbitrarily large, w
e can exert | 253 // Since the path length / dash length ratio may be arbitrarily large, w
e can exert |
254 // significant memory pressure while attempting to build the filtered pa
th. To avoid this, | 254 // significant memory pressure while attempting to build the filtered pa
th. To avoid this, |
255 // we simply give up dashing beyond a certain threshold. | 255 // we simply give up dashing beyond a certain threshold. |
(...skipping 65 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 |