| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "SkOpAngle.h" | 7 #include "SkOpAngle.h" |
| 8 #include "SkOpSegment.h" | 8 #include "SkOpSegment.h" |
| 9 #include "SkPathOpsCurve.h" | 9 #include "SkPathOpsCurve.h" |
| 10 #include "SkTSort.h" | 10 #include "SkTSort.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return COMPARE_RESULT(13, !lrOrder); | 174 return COMPARE_RESULT(13, !lrOrder); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // given a line, see if the opposite curve's convex hull is all on one side | 177 // given a line, see if the opposite curve's convex hull is all on one side |
| 178 // returns -1=not on one side 0=this CW of test 1=this CCW of test | 178 // returns -1=not on one side 0=this CW of test 1=this CCW of test |
| 179 int SkOpAngle::allOnOneSide(const SkOpAngle* test) { | 179 int SkOpAngle::allOnOneSide(const SkOpAngle* test) { |
| 180 SkASSERT(!fIsCurve); | 180 SkASSERT(!fIsCurve); |
| 181 SkASSERT(test->fIsCurve); | 181 SkASSERT(test->fIsCurve); |
| 182 SkDPoint origin = fCurvePart[0]; | 182 SkDPoint origin = fCurvePart[0]; |
| 183 SkDVector line = fCurvePart[1] - origin; | 183 SkDVector line = fCurvePart[1] - origin; |
| 184 float crosses[3]; | 184 double crosses[3]; |
| 185 SkPath::Verb testVerb = test->segment()->verb(); | 185 SkPath::Verb testVerb = test->segment()->verb(); |
| 186 int iMax = SkPathOpsVerbToPoints(testVerb); | 186 int iMax = SkPathOpsVerbToPoints(testVerb); |
| 187 // SkASSERT(origin == test.fCurveHalf[0]); | 187 // SkASSERT(origin == test.fCurveHalf[0]); |
| 188 const SkDCurve& testCurve = test->fCurvePart; | 188 const SkDCurve& testCurve = test->fCurvePart; |
| 189 for (int index = 1; index <= iMax; ++index) { | 189 for (int index = 1; index <= iMax; ++index) { |
| 190 float xy1 = (float) (line.fX * (testCurve[index].fY - origin.fY)); | 190 double xy1 = line.fX * (testCurve[index].fY - origin.fY); |
| 191 float xy2 = (float) (line.fY * (testCurve[index].fX - origin.fX)); | 191 double xy2 = line.fY * (testCurve[index].fX - origin.fX); |
| 192 crosses[index - 1] = AlmostEqualUlps(xy1, xy2) ? 0 : xy1 - xy2; | 192 crosses[index - 1] = AlmostBequalUlps(xy1, xy2) ? 0 : xy1 - xy2; |
| 193 } | 193 } |
| 194 if (crosses[0] * crosses[1] < 0) { | 194 if (crosses[0] * crosses[1] < 0) { |
| 195 return -1; | 195 return -1; |
| 196 } | 196 } |
| 197 if (SkPath::kCubic_Verb == testVerb) { | 197 if (SkPath::kCubic_Verb == testVerb) { |
| 198 if (crosses[0] * crosses[2] < 0 || crosses[1] * crosses[2] < 0) { | 198 if (crosses[0] * crosses[2] < 0 || crosses[1] * crosses[2] < 0) { |
| 199 return -1; | 199 return -1; |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 if (crosses[0]) { | 202 if (crosses[0]) { |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 return true; | 1050 return true; |
| 1051 } | 1051 } |
| 1052 SkASSERT(s0dt0 != 0); | 1052 SkASSERT(s0dt0 != 0); |
| 1053 double m = s0xt0 / s0dt0; | 1053 double m = s0xt0 / s0dt0; |
| 1054 double sDist = sweep[0].length() * m; | 1054 double sDist = sweep[0].length() * m; |
| 1055 double tDist = tweep[0].length() * m; | 1055 double tDist = tweep[0].length() * m; |
| 1056 bool useS = fabs(sDist) < fabs(tDist); | 1056 bool useS = fabs(sDist) < fabs(tDist); |
| 1057 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD
ist)); | 1057 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD
ist)); |
| 1058 return mFactor < 50; // empirically found limit | 1058 return mFactor < 50; // empirically found limit |
| 1059 } | 1059 } |
| OLD | NEW |