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

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

Issue 2055253002: Add control over whether lines are special cased in SkDashPath. Disable when called from GrShape. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: update comments Created 4 years, 6 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
« no previous file with comments | « src/gpu/GrStyle.cpp ('k') | src/utils/SkDashPathPriv.h » ('j') | 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 #include "SkStrokeRec.h" 10 #include "SkStrokeRec.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 SkPoint fPts[2]; 209 SkPoint fPts[2];
210 SkVector fTangent; 210 SkVector fTangent;
211 SkVector fNormal; 211 SkVector fNormal;
212 SkScalar fPathLength; 212 SkScalar fPathLength;
213 }; 213 };
214 214
215 215
216 bool SkDashPath::InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec , 216 bool SkDashPath::InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec ,
217 const SkRect* cullRect, const SkScalar aInterval s[], 217 const SkRect* cullRect, const SkScalar aInterval s[],
218 int32_t count, SkScalar initialDashLength, int32 _t initialDashIndex, 218 int32_t count, SkScalar initialDashLength, int32 _t initialDashIndex,
219 SkScalar intervalLength) { 219 SkScalar intervalLength,
220 StrokeRecApplication strokeRecApplication) {
220 221
221 // we do nothing if the src wants to be filled 222 // we do nothing if the src wants to be filled
222 SkStrokeRec::Style style = rec->getStyle(); 223 SkStrokeRec::Style style = rec->getStyle();
223 if (SkStrokeRec::kFill_Style == style || SkStrokeRec::kStrokeAndFill_Style = = style) { 224 if (SkStrokeRec::kFill_Style == style || SkStrokeRec::kStrokeAndFill_Style = = style) {
224 return false; 225 return false;
225 } 226 }
226 227
227 const SkScalar* intervals = aIntervals; 228 const SkScalar* intervals = aIntervals;
228 SkScalar dashCount = 0; 229 SkScalar dashCount = 0;
229 int segCount = 0; 230 int segCount = 0;
230 231
231 SkPath cullPathStorage; 232 SkPath cullPathStorage;
232 const SkPath* srcPtr = &src; 233 const SkPath* srcPtr = &src;
233 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) { 234 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) {
234 srcPtr = &cullPathStorage; 235 srcPtr = &cullPathStorage;
235 } 236 }
236 237
237 SpecialLineRec lineRec; 238 SpecialLineRec lineRec;
238 bool specialLine = lineRec.init(*srcPtr, dst, rec, count >> 1, intervalLengt h); 239 bool specialLine = (StrokeRecApplication::kAllow == strokeRecApplication) &&
240 lineRec.init(*srcPtr, dst, rec, count >> 1, intervalLengt h);
239 241
240 SkPathMeasure meas(*srcPtr, false, rec->getResScale()); 242 SkPathMeasure meas(*srcPtr, false, rec->getResScale());
241 243
242 do { 244 do {
243 bool skipFirstSegment = meas.isClosed(); 245 bool skipFirstSegment = meas.isClosed();
244 bool addedSegment = false; 246 bool addedSegment = false;
245 SkScalar length = meas.getLength(); 247 SkScalar length = meas.getLength();
246 int index = initialDashIndex; 248 int index = initialDashIndex;
247 249
248 // Since the path length / dash length ratio may be arbitrarily large, w e can exert 250 // Since the path length / dash length ratio may be arbitrarily large, w e can exert
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 SkScalar length = 0; 336 SkScalar length = 0;
335 for (int i = 0; i < count; i++) { 337 for (int i = 0; i < count; i++) {
336 if (intervals[i] < 0) { 338 if (intervals[i] < 0) {
337 return false; 339 return false;
338 } 340 }
339 length += intervals[i]; 341 length += intervals[i];
340 } 342 }
341 // watch out for values that might make us go out of bounds 343 // watch out for values that might make us go out of bounds
342 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length); 344 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length);
343 } 345 }
OLDNEW
« no previous file with comments | « src/gpu/GrStyle.cpp ('k') | src/utils/SkDashPathPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698