| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 "SkStrokerPriv.h" | 8 #include "SkStrokerPriv.h" |
| 9 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 SkScalar dist2 = pt_to_line(end, start, quadPts->fTangentStart); | 1049 SkScalar dist2 = pt_to_line(end, start, quadPts->fTangentStart); |
| 1050 if (SkTMax(dist1, dist2) <= fInvResScaleSquared) { | 1050 if (SkTMax(dist1, dist2) <= fInvResScaleSquared) { |
| 1051 return STROKER_RESULT(kDegenerate_ResultType, depth, quadPts, | 1051 return STROKER_RESULT(kDegenerate_ResultType, depth, quadPts, |
| 1052 "SkTMax(dist1=%g, dist2=%g) <= fInvResScaleSquared", dist1,
dist2); | 1052 "SkTMax(dist1=%g, dist2=%g) <= fInvResScaleSquared", dist1,
dist2); |
| 1053 } | 1053 } |
| 1054 return STROKER_RESULT(kSplit_ResultType, depth, quadPts, | 1054 return STROKER_RESULT(kSplit_ResultType, depth, quadPts, |
| 1055 "(numerA=%g >= 0) == (numerB=%g >= 0)", numerA, numerB); | 1055 "(numerA=%g >= 0) == (numerB=%g >= 0)", numerA, numerB); |
| 1056 } | 1056 } |
| 1057 // check to see if the denomerator is teeny relative to the numerator | 1057 // check to see if the denomerator is teeny relative to the numerator |
| 1058 bool validDivide = SkScalarAbs(numerA) * SK_ScalarNearlyZero < SkScalarAbs(d
enom); | 1058 bool validDivide = SkScalarAbs(numerA) * SK_ScalarNearlyZero < SkScalarAbs(d
enom); |
| 1059 SkASSERT(!SkScalarNearlyZero(denom / numerA) == validDivide); | 1059 // the divide check is the same as checking if the scaled denom is nearly zero |
| 1060 // (commented out because on some platforms the two are not bit-identical) |
| 1061 // SkASSERT(!SkScalarNearlyZero(denom / numerA) == validDivide); |
| 1060 if (validDivide) { | 1062 if (validDivide) { |
| 1061 if (kCtrlPt_RayType == intersectRayType) { | 1063 if (kCtrlPt_RayType == intersectRayType) { |
| 1062 numerA /= denom; | 1064 numerA /= denom; |
| 1063 SkPoint* ctrlPt = &quadPts->fQuad[1]; | 1065 SkPoint* ctrlPt = &quadPts->fQuad[1]; |
| 1064 // the intersection of the tangents need not be on the tangent segme
nt | 1066 // the intersection of the tangents need not be on the tangent segme
nt |
| 1065 // so 0 <= numerA <= 1 is not necessarily true | 1067 // so 0 <= numerA <= 1 is not necessarily true |
| 1066 ctrlPt->fX = start.fX * (1 - numerA) + quadPts->fTangentStart.fX * n
umerA; | 1068 ctrlPt->fX = start.fX * (1 - numerA) + quadPts->fTangentStart.fX * n
umerA; |
| 1067 ctrlPt->fY = start.fY * (1 - numerA) + quadPts->fTangentStart.fY * n
umerA; | 1069 ctrlPt->fY = start.fY * (1 - numerA) + quadPts->fTangentStart.fY * n
umerA; |
| 1068 } | 1070 } |
| 1069 return STROKER_RESULT(kQuad_ResultType, depth, quadPts, | 1071 return STROKER_RESULT(kQuad_ResultType, depth, quadPts, |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 default: | 1756 default: |
| 1755 break; | 1757 break; |
| 1756 } | 1758 } |
| 1757 | 1759 |
| 1758 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 1760 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { |
| 1759 r = rect; | 1761 r = rect; |
| 1760 r.inset(radius, radius); | 1762 r.inset(radius, radius); |
| 1761 dst->addRect(r, reverse_direction(dir)); | 1763 dst->addRect(r, reverse_direction(dir)); |
| 1762 } | 1764 } |
| 1763 } | 1765 } |
| OLD | NEW |