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

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

Issue 2048183002: Make SkDashPathEffect fail for stroke+fill style (in addition to fill style) (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: update 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') | tests/GrShapeTest.cpp » ('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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 220
221 // we do nothing if the src wants to be filled 221 // we do nothing if the src wants to be filled
222 if (rec->isFillStyle()) { 222 SkStrokeRec::Style style = rec->getStyle();
223 if (SkStrokeRec::kFill_Style == style || SkStrokeRec::kStrokeAndFill_Style = = style) {
223 return false; 224 return false;
224 } 225 }
225 226
226 const SkScalar* intervals = aIntervals; 227 const SkScalar* intervals = aIntervals;
227 SkScalar dashCount = 0; 228 SkScalar dashCount = 0;
228 int segCount = 0; 229 int segCount = 0;
229 230
230 SkPath cullPathStorage; 231 SkPath cullPathStorage;
231 const SkPath* srcPtr = &src; 232 const SkPath* srcPtr = &src;
232 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) { 233 if (cull_path(src, *rec, cullRect, intervalLength, &cullPathStorage)) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 SkScalar length = 0; 334 SkScalar length = 0;
334 for (int i = 0; i < count; i++) { 335 for (int i = 0; i < count; i++) {
335 if (intervals[i] < 0) { 336 if (intervals[i] < 0) {
336 return false; 337 return false;
337 } 338 }
338 length += intervals[i]; 339 length += intervals[i];
339 } 340 }
340 // watch out for values that might make us go out of bounds 341 // watch out for values that might make us go out of bounds
341 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length); 342 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length);
342 } 343 }
OLDNEW
« no previous file with comments | « src/gpu/GrStyle.cpp ('k') | tests/GrShapeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698