OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGeometry.h" | 8 #include "SkGeometry.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 for (int j = 0; j < 3; ++j) { | 51 for (int j = 0; j < 3; ++j) { |
52 pts[j].set(rand.nextSScalar1() * 100, rand.nextSScalar1() * 100); | 52 pts[j].set(rand.nextSScalar1() * 100, rand.nextSScalar1() * 100); |
53 } | 53 } |
54 const SkScalar dt = SK_Scalar1 / 128; | 54 const SkScalar dt = SK_Scalar1 / 128; |
55 SkScalar t = dt; | 55 SkScalar t = dt; |
56 for (int j = 1; j < 128; ++j) { | 56 for (int j = 1; j < 128; ++j) { |
57 SkPoint r0; | 57 SkPoint r0; |
58 SkEvalQuadAt(pts, t, &r0); | 58 SkEvalQuadAt(pts, t, &r0); |
59 SkPoint r1 = SkEvalQuadAt(pts, t); | 59 SkPoint r1 = SkEvalQuadAt(pts, t); |
60 check_pairs(reporter, i, t, "quad-pos", r0.fX, r0.fY, r1.fX, r1.fY); | 60 check_pairs(reporter, i, t, "quad-pos", r0.fX, r0.fY, r1.fX, r1.fY); |
61 | 61 |
62 SkVector v0; | 62 SkVector v0; |
63 SkEvalQuadAt(pts, t, nullptr, &v0); | 63 SkEvalQuadAt(pts, t, nullptr, &v0); |
64 SkVector v1 = SkEvalQuadTangentAt(pts, t); | 64 SkVector v1 = SkEvalQuadTangentAt(pts, t); |
65 check_pairs(reporter, i, t, "quad-tan", v0.fX, v0.fY, v1.fX, v1.fY); | 65 check_pairs(reporter, i, t, "quad-tan", v0.fX, v0.fY, v1.fX, v1.fY); |
66 | 66 |
67 t += dt; | 67 t += dt; |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i])); | 187 REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i])); |
188 } | 188 } |
189 | 189 |
190 testChopCubic(reporter); | 190 testChopCubic(reporter); |
191 test_evalquadat(reporter); | 191 test_evalquadat(reporter); |
192 test_conic(reporter); | 192 test_conic(reporter); |
193 test_cubic_tangents(reporter); | 193 test_cubic_tangents(reporter); |
194 test_quad_tangents(reporter); | 194 test_quad_tangents(reporter); |
195 test_conic_tangents(reporter); | 195 test_conic_tangents(reporter); |
196 } | 196 } |
OLD | NEW |