OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkDashPathEffect.h" | 8 #include "SkDashPathEffect.h" |
9 | 9 |
10 #include "SkDashPathPriv.h" | 10 #include "SkDashPathPriv.h" |
11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
13 #include "SkStrokeRec.h" | 13 #include "SkStrokeRec.h" |
14 | 14 |
15 SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count, SkScal ar phase) | 15 SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count, SkScal ar phase) |
16 : fPhase(0) | 16 : fPhase(0) |
robertphillips
2016/03/16 18:01:39
Don't we use a -1 initial dash length as a signal
caryclark
2016/03/16 18:45:54
Switched to explict flag. Please let me know if yo
| |
17 , fInitialDashLength(0) | 17 , fInitialDashLength(-1) |
18 , fInitialDashIndex(0) | 18 , fInitialDashIndex(0) |
19 , fIntervalLength(0) { | 19 , fIntervalLength(0) { |
20 SkASSERT(intervals); | 20 SkASSERT(intervals); |
21 SkASSERT(count > 1 && SkAlign2(count) == count); | 21 SkASSERT(count > 1 && SkAlign2(count) == count); |
22 | 22 |
23 fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * count); | 23 fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * count); |
24 fCount = count; | 24 fCount = count; |
25 for (int i = 0; i < count; i++) { | 25 for (int i = 0; i < count; i++) { |
26 SkASSERT(intervals[i] >= 0); | 26 SkASSERT(intervals[i] >= 0); |
27 fIntervals[i] = intervals[i]; | 27 fIntervals[i] = intervals[i]; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 if ((count < 2) || !SkIsAlign2(count)) { | 391 if ((count < 2) || !SkIsAlign2(count)) { |
392 return nullptr; | 392 return nullptr; |
393 } | 393 } |
394 for (int i = 0; i < count; i++) { | 394 for (int i = 0; i < count; i++) { |
395 if (intervals[i] < 0) { | 395 if (intervals[i] < 0) { |
396 return nullptr; | 396 return nullptr; |
397 } | 397 } |
398 } | 398 } |
399 return new SkDashPathEffect(intervals, count, phase); | 399 return new SkDashPathEffect(intervals, count, phase); |
400 } | 400 } |
OLD | NEW |