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

Side by Side Diff: experimental/Intersection/MiniSimplify_Test.cpp

Issue 867213004: remove prototype pathops code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « experimental/Intersection/LogoPlay.cpp ('k') | experimental/Intersection/NearestPoint.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "EdgeWalker_Test.h"
2 #include "Intersection_Tests.h"
3 #include "ShapeOps.h"
4
5 bool gShowOriginal = true;
6
7 struct curve {
8 SkPath::Verb verb;
9 SkPoint pts[4];
10 };
11
12 struct curve test1[] = {
13 {SkPath::kQuad_Verb, {{366.608826f, 151.196014f}, {378.803101f, 136.674606f}, {3 98.164948f, 136.674606f}}},
14 {SkPath::kLine_Verb, {{354.009216f, 208.816208f}, {393.291473f, 102.232819f}}},
15 {SkPath::kQuad_Verb, {{359.978058f, 136.581512f}, {378.315979f, 136.581512f}, {3 88.322723f, 149.613556f}}},
16 {SkPath::kQuad_Verb, {{364.390686f, 157.898193f}, {375.281769f, 136.674606f}, {3 96.039917f, 136.674606f}}},
17 {SkPath::kLine_Verb, {{396.039917f, 136.674606f}, {350, 120}}},
18 {SkPath::kDone_Verb}
19 };
20
21 struct curve test2[] = {
22 {SkPath::kQuad_Verb, {{366.608826f, 151.196014f}, {378.803101f, 136.674606f}, {3 98.164948f, 136.674606f}}},
23 {SkPath::kQuad_Verb, {{359.978058f, 136.581512f}, {378.315979f, 136.581512f}, {3 88.322723f, 149.613556f}}},
24 {SkPath::kQuad_Verb, {{364.390686f, 157.898193f}, {375.281769f, 136.674606f}, {3 96.039917f, 136.674606f}}},
25 {SkPath::kDone_Verb}
26 };
27
28 struct curve* testSet[] = {
29 test2,
30 test1
31 };
32
33 size_t testSet_count = sizeof(testSet) / sizeof(testSet[0]);
34
35 static void construct() {
36 for (size_t idx = 0; idx < testSet_count; ++idx) {
37 const curve* test = testSet[idx];
38 SkPath path;
39 bool pathComplete = false;
40 bool first = true;
41 do {
42 if (first) {
43 path.moveTo(test->pts[0].fX, test->pts[0].fY);
44 first = false;
45 } else if (test->verb != SkPath::kDone_Verb) {
46 path.lineTo(test->pts[0].fX, test->pts[0].fY);
47 }
48 switch (test->verb) {
49 case SkPath::kDone_Verb:
50 pathComplete = true;
51 break;
52 case SkPath::kLine_Verb:
53 path.lineTo(test->pts[1].fX, test->pts[1].fY);
54 break;
55 case SkPath::kQuad_Verb:
56 path.quadTo(test->pts[1].fX, test->pts[1].fY, test->pts[2].f X, test->pts[2].fY);
57 break;
58 case SkPath::kCubic_Verb:
59 path.cubicTo(test->pts[1].fX, test->pts[1].fY, test->pts[2]. fX, test->pts[2].fY, test->pts[3].fX, test->pts[3].fY);
60 break;
61 default:
62 SkASSERT(0);
63 }
64 test++;
65 } while (!pathComplete);
66 path.close();
67 if (gShowOriginal) {
68 showPath(path, NULL);
69 SkDebugf("simplified:\n");
70 }
71 testSimplifyx(path);
72 }
73 }
74
75 static void (*tests[])() = {
76 construct,
77 };
78
79 static const size_t testCount = sizeof(tests) / sizeof(tests[0]);
80
81 static void (*firstTest)() = 0;
82 static bool skipAll = false;
83
84 void MiniSimplify_Test() {
85 if (skipAll) {
86 return;
87 }
88 size_t index = 0;
89 if (firstTest) {
90 while (index < testCount && tests[index] != firstTest) {
91 ++index;
92 }
93 }
94 bool firstTestComplete = false;
95 for ( ; index < testCount; ++index) {
96 (*tests[index])();
97 firstTestComplete = true;
98 }
99 }
OLDNEW
« no previous file with comments | « experimental/Intersection/LogoPlay.cpp ('k') | experimental/Intersection/NearestPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698