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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const SkMatrix& ctm, const SkRect* cullRect, | 59 const SkMatrix& ctm, const SkRect* cullRect, |
60 const SkScalar intervalLength) { | 60 const SkScalar intervalLength) { |
61 if (NULL == cullRect) { | 61 if (NULL == cullRect) { |
62 SkASSERT(false); // Shouldn't ever occur in practice | 62 SkASSERT(false); // Shouldn't ever occur in practice |
63 return false; | 63 return false; |
64 } | 64 } |
65 | 65 |
66 SkScalar dx = pts[1].x() - pts[0].x(); | 66 SkScalar dx = pts[1].x() - pts[0].x(); |
67 SkScalar dy = pts[1].y() - pts[0].y(); | 67 SkScalar dy = pts[1].y() - pts[0].y(); |
68 | 68 |
69 if (dx && dy) { | 69 if ((dx && dy) || (!dx && !dy)) { |
70 return false; | 70 return false; |
71 } | 71 } |
72 | 72 |
73 SkRect bounds = *cullRect; | 73 SkRect bounds = *cullRect; |
74 outset_for_stroke(&bounds, rec); | 74 outset_for_stroke(&bounds, rec); |
75 | 75 |
76 // cullRect is in device space while pts are in the local coordinate system | 76 // cullRect is in device space while pts are in the local coordinate system |
77 // defined by the ctm. We want our answer in the local coordinate system. | 77 // defined by the ctm. We want our answer in the local coordinate system. |
78 | 78 |
79 SkASSERT(ctm.rectStaysRect()); | 79 SkASSERT(ctm.rectStaysRect()); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 406 } |
407 } else { | 407 } else { |
408 // set the internal data members, fPhase should have been between 0 and
intervalLength | 408 // set the internal data members, fPhase should have been between 0 and
intervalLength |
409 // when written to buffer so no need to adjust it | 409 // when written to buffer so no need to adjust it |
410 SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount, | 410 SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount, |
411 &fInitialDashLength, &fInitialDashIndex, &fIntervalLength); | 411 &fInitialDashLength, &fInitialDashIndex, &fIntervalLength); |
412 } | 412 } |
413 } | 413 } |
414 #endif | 414 #endif |
415 | 415 |
OLD | NEW |