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

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

Issue 703783002: Bug fix for cull_line in SkDashPathEffect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add test cases to dashing gm Created 6 years, 1 month 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
« no previous file with comments | « src/effects/SkDashPathEffect.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return false; 112 return false;
113 } 113 }
114 114
115 SkScalar minX = pts[0].fX; 115 SkScalar minX = pts[0].fX;
116 SkScalar maxX = pts[1].fX; 116 SkScalar maxX = pts[1].fX;
117 117
118 if (dx < 0) { 118 if (dx < 0) {
119 SkTSwap(minX, maxX); 119 SkTSwap(minX, maxX);
120 } 120 }
121 121
122 SkASSERT(minX < maxX); 122 SkASSERT(minX <= maxX);
123 if (maxX < bounds.fLeft || minX > bounds.fRight) { 123 if (maxX < bounds.fLeft || minX > bounds.fRight) {
124 return false; 124 return false;
125 } 125 }
126 126
127 // Now we actually perform the chop, removing the excess to the left and 127 // Now we actually perform the chop, removing the excess to the left and
128 // right of the bounds (keeping our new line "in phase" with the dash, 128 // right of the bounds (keeping our new line "in phase" with the dash,
129 // hence the (mod intervalLength). 129 // hence the (mod intervalLength).
130 130
131 if (minX < bounds.fLeft) { 131 if (minX < bounds.fLeft) {
132 minX = bounds.fLeft - SkScalarMod(bounds.fLeft - minX, 132 minX = bounds.fLeft - SkScalarMod(bounds.fLeft - minX,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « src/effects/SkDashPathEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698