| 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 return false; | 900 return false; |
| 901 } | 901 } |
| 902 SkScalar dot = smaller.dot(larger); | 902 SkScalar dot = smaller.dot(larger); |
| 903 return dot > 0; | 903 return dot > 0; |
| 904 } | 904 } |
| 905 | 905 |
| 906 SkPathStroker::ResultType SkPathStroker::strokeCloseEnough(const SkPoint stroke[
3], | 906 SkPathStroker::ResultType SkPathStroker::strokeCloseEnough(const SkPoint stroke[
3], |
| 907 const SkPoint ray[2], SkQuadConstruct* quadPts STROKER_DEBUG_PARAMS(int
depth)) const { | 907 const SkPoint ray[2], SkQuadConstruct* quadPts STROKER_DEBUG_PARAMS(int
depth)) const { |
| 908 SkPoint strokeMid = SkEvalQuadAt(stroke, SK_ScalarHalf); | 908 SkPoint strokeMid = SkEvalQuadAt(stroke, SK_ScalarHalf); |
| 909 // measure the distance from the curve to the quad-stroke midpoint, compare
to radius | 909 // measure the distance from the curve to the quad-stroke midpoint, compare
to radius |
| 910 if (points_within_dist(ray[0], strokeMid, fInvResScaleSquared)) { // if the
difference is small | 910 if (points_within_dist(ray[0], strokeMid, fInvResScale)) { // if the differ
ence is small |
| 911 if (sharp_angle(quadPts->fQuad)) { | 911 if (sharp_angle(quadPts->fQuad)) { |
| 912 return STROKER_RESULT(kSplit_ResultType, depth, quadPts, | 912 return STROKER_RESULT(kSplit_ResultType, depth, quadPts, |
| 913 "sharp_angle (1) =%g,%g, %g,%g, %g,%g", | 913 "sharp_angle (1) =%g,%g, %g,%g, %g,%g", |
| 914 quadPts->fQuad[0].fX, quadPts->fQuad[0].fY, | 914 quadPts->fQuad[0].fX, quadPts->fQuad[0].fY, |
| 915 quadPts->fQuad[1].fX, quadPts->fQuad[1].fY, | 915 quadPts->fQuad[1].fX, quadPts->fQuad[1].fY, |
| 916 quadPts->fQuad[2].fX, quadPts->fQuad[2].fY); | 916 quadPts->fQuad[2].fX, quadPts->fQuad[2].fY); |
| 917 } | 917 } |
| 918 return STROKER_RESULT(kQuad_ResultType, depth, quadPts, | 918 return STROKER_RESULT(kQuad_ResultType, depth, quadPts, |
| 919 "points_within_dist(ray[0]=%g,%g, strokeMid=%g,%g, fInvResScaleS
quared=%g)", | 919 "points_within_dist(ray[0]=%g,%g, strokeMid=%g,%g, fInvResScale=
%g)", |
| 920 ray[0].fX, ray[0].fY, strokeMid.fX, strokeMid.fY, fInvResScaleSq
uared); | 920 ray[0].fX, ray[0].fY, strokeMid.fX, strokeMid.fY, fInvResScale); |
| 921 } | 921 } |
| 922 // measure the distance to quad's bounds (quick reject) | 922 // measure the distance to quad's bounds (quick reject) |
| 923 // an alternative : look for point in triangle | 923 // an alternative : look for point in triangle |
| 924 if (!ptInQuadBounds(stroke, ray[0])) { // if far, subdivide | 924 if (!ptInQuadBounds(stroke, ray[0])) { // if far, subdivide |
| 925 return STROKER_RESULT(kSplit_ResultType, depth, quadPts, | 925 return STROKER_RESULT(kSplit_ResultType, depth, quadPts, |
| 926 "!pt_in_quad_bounds(stroke=(%g,%g %g,%g %g,%g), ray[0]=%g,%g)", | 926 "!pt_in_quad_bounds(stroke=(%g,%g %g,%g %g,%g), ray[0]=%g,%g)", |
| 927 stroke[0].fX, stroke[0].fY, stroke[1].fX, stroke[1].fY, stroke[2
].fX, stroke[2].fY, | 927 stroke[0].fX, stroke[0].fY, stroke[1].fX, stroke[1].fY, stroke[2
].fX, stroke[2].fY, |
| 928 ray[0].fX, ray[0].fY); | 928 ray[0].fX, ray[0].fY); |
| 929 } | 929 } |
| 930 // measure the curve ray distance to the quad-stroke | 930 // measure the curve ray distance to the quad-stroke |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 default: | 1450 default: |
| 1451 break; | 1451 break; |
| 1452 } | 1452 } |
| 1453 | 1453 |
| 1454 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 1454 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { |
| 1455 r = rect; | 1455 r = rect; |
| 1456 r.inset(radius, radius); | 1456 r.inset(radius, radius); |
| 1457 dst->addRect(r, reverse_direction(dir)); | 1457 dst->addRect(r, reverse_direction(dir)); |
| 1458 } | 1458 } |
| 1459 } | 1459 } |
| OLD | NEW |