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 "SkDQuadImplicit.h" | 7 #include "SkDQuadImplicit.h" |
8 #include "SkPathOpsQuad.h" | 8 #include "SkPathOpsQuad.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "TestClassDef.h" | |
11 | 10 |
12 static bool point_on_parameterized_curve(const SkDQuad& quad, const SkDPoint& po
int) { | 11 static bool point_on_parameterized_curve(const SkDQuad& quad, const SkDPoint& po
int) { |
13 SkDQuadImplicit q(quad); | 12 SkDQuadImplicit q(quad); |
14 double xx = q.x2() * point.fX * point.fX; | 13 double xx = q.x2() * point.fX * point.fX; |
15 double xy = q.xy() * point.fX * point.fY; | 14 double xy = q.xy() * point.fX * point.fY; |
16 double yy = q.y2() * point.fY * point.fY; | 15 double yy = q.y2() * point.fY * point.fY; |
17 double x = q.x() * point.fX; | 16 double x = q.x() * point.fX; |
18 double y = q.y() * point.fY; | 17 double y = q.y() * point.fY; |
19 double c = q.c(); | 18 double c = q.c(); |
20 double sum = xx + xy + yy + x + y + c; | 19 double sum = xx + xy + yy + x + y + c; |
(...skipping 21 matching lines...) Expand all Loading... |
42 for (size_t two = 0; two < quadsCount; ++two) { | 41 for (size_t two = 0; two < quadsCount; ++two) { |
43 for (size_t inner = 0; inner < 3; inner += 2) { | 42 for (size_t inner = 0; inner < 3; inner += 2) { |
44 REPORTER_ASSERT(reporter, point_on_parameterized_curve(*qua
ds[one], | 43 REPORTER_ASSERT(reporter, point_on_parameterized_curve(*qua
ds[one], |
45 (*quads[two])[inner])); | 44 (*quads[two])[inner])); |
46 } | 45 } |
47 REPORTER_ASSERT(reporter, SkDQuadImplicit::Match(*quads[one], *q
uads[two])); | 46 REPORTER_ASSERT(reporter, SkDQuadImplicit::Match(*quads[one], *q
uads[two])); |
48 } | 47 } |
49 } | 48 } |
50 } | 49 } |
51 } | 50 } |
OLD | NEW |