| OLD | NEW | 
|---|
| 1 | 1 | 
| 2 /* | 2 /* | 
| 3  * Copyright 2008 The Android Open Source Project | 3  * Copyright 2008 The Android Open Source Project | 
| 4  * | 4  * | 
| 5  * Use of this source code is governed by a BSD-style license that can be | 5  * Use of this source code is governed by a BSD-style license that can be | 
| 6  * found in the LICENSE file. | 6  * found in the LICENSE file. | 
| 7  */ | 7  */ | 
| 8 | 8 | 
| 9 | 9 | 
| 10 #include "SkPathMeasure.h" | 10 #include "SkPathMeasure.h" | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 66     // diff = -a/4 + b/2 - c/4 | 66     // diff = -a/4 + b/2 - c/4 | 
| 67     SkScalar dx = SkScalarHalf(pts[1].fX) - | 67     SkScalar dx = SkScalarHalf(pts[1].fX) - | 
| 68                         SkScalarHalf(SkScalarHalf(pts[0].fX + pts[2].fX)); | 68                         SkScalarHalf(SkScalarHalf(pts[0].fX + pts[2].fX)); | 
| 69     SkScalar dy = SkScalarHalf(pts[1].fY) - | 69     SkScalar dy = SkScalarHalf(pts[1].fY) - | 
| 70                         SkScalarHalf(SkScalarHalf(pts[0].fY + pts[2].fY)); | 70                         SkScalarHalf(SkScalarHalf(pts[0].fY + pts[2].fY)); | 
| 71 | 71 | 
| 72     SkScalar dist = SkMaxScalar(SkScalarAbs(dx), SkScalarAbs(dy)); | 72     SkScalar dist = SkMaxScalar(SkScalarAbs(dx), SkScalarAbs(dy)); | 
| 73     return dist > CHEAP_DIST_LIMIT; | 73     return dist > CHEAP_DIST_LIMIT; | 
| 74 } | 74 } | 
| 75 | 75 | 
|  | 76 #ifndef SK_SUPPORT_LEGACY_CONIC_MEASURE | 
| 76 static bool conic_too_curvy(const SkPoint& firstPt, const SkPoint& midTPt, | 77 static bool conic_too_curvy(const SkPoint& firstPt, const SkPoint& midTPt, | 
| 77                             const SkPoint& lastPt) { | 78                             const SkPoint& lastPt) { | 
| 78     SkPoint midEnds = firstPt + lastPt; | 79     SkPoint midEnds = firstPt + lastPt; | 
| 79     midEnds *= 0.5f; | 80     midEnds *= 0.5f; | 
| 80     SkVector dxy = midTPt - midEnds; | 81     SkVector dxy = midTPt - midEnds; | 
| 81     SkScalar dist = SkMaxScalar(SkScalarAbs(dxy.fX), SkScalarAbs(dxy.fY)); | 82     SkScalar dist = SkMaxScalar(SkScalarAbs(dxy.fX), SkScalarAbs(dxy.fY)); | 
| 82     return dist > CHEAP_DIST_LIMIT; | 83     return dist > CHEAP_DIST_LIMIT; | 
| 83 } | 84 } | 
|  | 85 #endif | 
| 84 | 86 | 
| 85 static bool cheap_dist_exceeds_limit(const SkPoint& pt, | 87 static bool cheap_dist_exceeds_limit(const SkPoint& pt, | 
| 86                                      SkScalar x, SkScalar y) { | 88                                      SkScalar x, SkScalar y) { | 
| 87     SkScalar dist = SkMaxScalar(SkScalarAbs(x - pt.fX), SkScalarAbs(y - pt.fY)); | 89     SkScalar dist = SkMaxScalar(SkScalarAbs(x - pt.fX), SkScalarAbs(y - pt.fY)); | 
| 88     // just made up the 1/2 | 90     // just made up the 1/2 | 
| 89     return dist > CHEAP_DIST_LIMIT; | 91     return dist > CHEAP_DIST_LIMIT; | 
| 90 } | 92 } | 
| 91 | 93 | 
| 92 static bool cubic_too_curvy(const SkPoint pts[4]) { | 94 static bool cubic_too_curvy(const SkPoint pts[4]) { | 
| 93     return  cheap_dist_exceeds_limit(pts[1], | 95     return  cheap_dist_exceeds_limit(pts[1], | 
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 748 | 750 | 
| 749     for (int i = 0; i < fSegments.count(); i++) { | 751     for (int i = 0; i < fSegments.count(); i++) { | 
| 750         const Segment* seg = &fSegments[i]; | 752         const Segment* seg = &fSegments[i]; | 
| 751         SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", | 753         SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", | 
| 752                 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), | 754                 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), | 
| 753                  seg->fType); | 755                  seg->fType); | 
| 754     } | 756     } | 
| 755 } | 757 } | 
| 756 | 758 | 
| 757 #endif | 759 #endif | 
| OLD | NEW | 
|---|