Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tests/PathOpsQuadParameterizationTest.cpp

Issue 131103009: update pathops to circle sort (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: disable old test that still fails on linux 32 release Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PathOpsQuadLineIntersectionThreadedTest.cpp ('k') | tests/PathOpsSimplifyFailTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
11 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) {
12 SkDQuadImplicit q(quad); 12 SkDQuadImplicit q(quad);
13 double xx = q.x2() * point.fX * point.fX; 13 double xx = q.x2() * point.fX * point.fX;
14 double xy = q.xy() * point.fX * point.fY; 14 double xy = q.xy() * point.fX * point.fY;
15 double yy = q.y2() * point.fY * point.fY; 15 double yy = q.y2() * point.fY * point.fY;
16 double x = q.x() * point.fX; 16 double x = q.x() * point.fX;
17 double y = q.y() * point.fY; 17 double y = q.y() * point.fY;
18 double c = q.c(); 18 double c = q.c();
19 double sum = xx + xy + yy + x + y + c; 19 double sum = xx + xy + yy + x + y + c;
20 return approximately_zero(sum); 20 return approximately_zero(sum);
21 } 21 }
22 22
23 static const SkDQuad quadratics[] = { 23 static const SkDQuad quadratics[] = {
24 {{{0, 0}, {1, 0}, {1, 1}}}, 24 {{{0, 0}, {1, 0}, {1, 1}}},
25 }; 25 };
26 26
27 static const size_t quadratics_count = SK_ARRAY_COUNT(quadratics); 27 static const int quadratics_count = (int) SK_ARRAY_COUNT(quadratics);
28 28
29 DEF_TEST(PathOpsQuadImplicit, reporter) { 29 DEF_TEST(PathOpsQuadImplicit, reporter) {
30 // split large quadratic 30 // split large quadratic
31 // compare original, parts, to see if the are coincident 31 // compare original, parts, to see if the are coincident
32 for (size_t index = 0; index < quadratics_count; ++index) { 32 for (int index = 0; index < quadratics_count; ++index) {
33 const SkDQuad& test = quadratics[index]; 33 const SkDQuad& test = quadratics[index];
34 SkDQuadPair split = test.chopAt(0.5); 34 SkDQuadPair split = test.chopAt(0.5);
35 SkDQuad midThird = test.subDivide(1.0/3, 2.0/3); 35 SkDQuad midThird = test.subDivide(1.0/3, 2.0/3);
36 const SkDQuad* quads[] = { 36 const SkDQuad* quads[] = {
37 &test, &midThird, &split.first(), &split.second() 37 &test, &midThird, &split.first(), &split.second()
38 }; 38 };
39 size_t quadsCount = SK_ARRAY_COUNT(quads); 39 int quadsCount = (int) SK_ARRAY_COUNT(quads);
40 for (size_t one = 0; one < quadsCount; ++one) { 40 for (int one = 0; one < quadsCount; ++one) {
41 for (size_t two = 0; two < quadsCount; ++two) { 41 for (int two = 0; two < quadsCount; ++two) {
42 for (size_t inner = 0; inner < 3; inner += 2) { 42 for (int inner = 0; inner < 3; inner += 2) {
43 REPORTER_ASSERT(reporter, point_on_parameterized_curve(*qua ds[one], 43 REPORTER_ASSERT(reporter, point_on_parameterized_curve(*qua ds[one],
44 (*quads[two])[inner])); 44 (*quads[two])[inner]));
45 } 45 }
46 REPORTER_ASSERT(reporter, SkDQuadImplicit::Match(*quads[one], *q uads[two])); 46 REPORTER_ASSERT(reporter, SkDQuadImplicit::Match(*quads[one], *q uads[two]));
47 } 47 }
48 } 48 }
49 } 49 }
50 } 50 }
OLDNEW
« no previous file with comments | « tests/PathOpsQuadLineIntersectionThreadedTest.cpp ('k') | tests/PathOpsSimplifyFailTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698