Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: src/utils/SkDashPath.cpp

Issue 1805963002: allow one zero length dash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: allow one zero length dash Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (index == count) { 298 if (index == count) {
299 index = 0; 299 index = 0;
300 } 300 }
301 301
302 // fetch our next dlen 302 // fetch our next dlen
303 dlen = intervals[index]; 303 dlen = intervals[index];
304 } 304 }
305 305
306 // extend if we ended on a segment and we need to join up with the (skip ped) initial segment 306 // extend if we ended on a segment and we need to join up with the (skip ped) initial segment
307 if (meas.isClosed() && is_even(initialDashIndex) && 307 if (meas.isClosed() && is_even(initialDashIndex) &&
308 initialDashLength > 0) { 308 initialDashLength >= 0) {
309 meas.getSegment(0, initialDashLength, dst, !addedSegment); 309 meas.getSegment(0, initialDashLength, dst, !addedSegment);
310 ++segCount; 310 ++segCount;
311 } 311 }
312 } while (meas.nextContour()); 312 } while (meas.nextContour());
313 313
314 if (segCount > 1) { 314 if (segCount > 1) {
315 dst->setConvexity(SkPath::kConcave_Convexity); 315 dst->setConvexity(SkPath::kConcave_Convexity);
316 } 316 }
317 317
318 return true; 318 return true;
319 } 319 }
320 320
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 }
OLDNEW
« src/effects/SkDashPathEffect.cpp ('K') | « src/effects/SkDashPathEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698