OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 7 |
8 #include "GrAAConvexTessellator.h" | 8 #include "GrAAConvexTessellator.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // tesselation tolerance values, in device space pixels | 24 // tesselation tolerance values, in device space pixels |
25 static const SkScalar kQuadTolerance = 0.2f; | 25 static const SkScalar kQuadTolerance = 0.2f; |
26 static const SkScalar kCubicTolerance = 0.2f; | 26 static const SkScalar kCubicTolerance = 0.2f; |
27 static const SkScalar kConicTolerance = 0.5f; | 27 static const SkScalar kConicTolerance = 0.5f; |
28 | 28 |
29 // dot product below which we use a round cap between curve segments | 29 // dot product below which we use a round cap between curve segments |
30 static const SkScalar kRoundCapThreshold = 0.8f; | 30 static const SkScalar kRoundCapThreshold = 0.8f; |
31 | 31 |
32 // dot product above which we consider two adjacent curves to be part of the "sa
me" curve | 32 // dot product above which we consider two adjacent curves to be part of the "sa
me" curve |
33 static const SkScalar kCurveConnectionThreshold = 0.95f; | 33 static const SkScalar kCurveConnectionThreshold = 0.8f; |
34 | 34 |
35 static SkScalar intersect(const SkPoint& p0, const SkPoint& n0, | 35 static SkScalar intersect(const SkPoint& p0, const SkPoint& n0, |
36 const SkPoint& p1, const SkPoint& n1) { | 36 const SkPoint& p1, const SkPoint& n1) { |
37 const SkPoint v = p1 - p0; | 37 const SkPoint v = p1 - p0; |
38 SkScalar perpDot = n0.fX * n1.fY - n0.fY * n1.fX; | 38 SkScalar perpDot = n0.fX * n1.fY - n0.fY * n1.fX; |
39 return (v.fX * n1.fY - v.fY * n1.fX) / perpDot; | 39 return (v.fX * n1.fY - v.fY * n1.fX) / perpDot; |
40 } | 40 } |
41 | 41 |
42 // This is a special case version of intersect where we have the vector | 42 // This is a special case version of intersect where we have the vector |
43 // perpendicular to the second line rather than the vector parallel to it. | 43 // perpendicular to the second line rather than the vector parallel to it. |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 | 1043 |
1044 SkString num; | 1044 SkString num; |
1045 num.printf("%d", i); | 1045 num.printf("%d", i); |
1046 canvas->drawText(num.c_str(), num.size(), | 1046 canvas->drawText(num.c_str(), num.size(), |
1047 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f
), | 1047 this->point(i).fX, this->point(i).fY+(kPointRadius/2.0f
), |
1048 paint); | 1048 paint); |
1049 } | 1049 } |
1050 } | 1050 } |
1051 | 1051 |
1052 #endif | 1052 #endif |
OLD | NEW |