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

Side by Side Diff: experimental/Intersection/QuadraticReduceOrder_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
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 #include "CurveIntersection.h"
8 #include "Intersection_Tests.h"
9 #include "QuadraticIntersection_TestData.h"
10 #include "TestUtilities.h"
11
12 static const Quadratic testSet[] = {
13 {{1, 1}, {2, 2}, {1, 1.000003}},
14 {{1, 0}, {2, 6}, {3, 0}}
15 };
16
17 static const size_t testSetCount = sizeof(testSet) / sizeof(testSet[0]);
18
19
20 static void oneOffTest() {
21 SkDebugf("%s FLT_EPSILON=%1.9g\n", __FUNCTION__, FLT_EPSILON);
22 for (size_t index = 0; index < testSetCount; ++index) {
23 const Quadratic& quad = testSet[index];
24 Quadratic reduce;
25 SkDEBUGCODE(int result = ) reduceOrder(quad, reduce, kReduceOrder_TreatA sFill);
26 SkASSERT(result == 3);
27 }
28 }
29
30 static void standardTestCases() {
31 size_t index;
32 Quadratic reduce;
33 int order;
34 enum {
35 RunAll,
36 RunQuadraticLines,
37 RunQuadraticModLines,
38 RunNone
39 } run = RunAll;
40 int firstTestIndex = 0;
41 #if 0
42 run = RunQuadraticLines;
43 firstTestIndex = 1;
44 #endif
45 int firstQuadraticLineTest = run == RunAll ? 0 : run == RunQuadraticLines ? firstTestIndex : SK_MaxS32;
46 int firstQuadraticModLineTest = run == RunAll ? 0 : run == RunQuadraticModLi nes ? firstTestIndex : SK_MaxS32;
47
48 for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
49 const Quadratic& quad = quadraticLines[index];
50 order = reduceOrder(quad, reduce, kReduceOrder_TreatAsFill);
51 if (order != 2) {
52 printf("[%d] line quad order=%d\n", (int) index, order);
53 }
54 }
55 for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_cou nt; ++index) {
56 const Quadratic& quad = quadraticModEpsilonLines[index];
57 order = reduceOrder(quad, reduce, kReduceOrder_TreatAsFill);
58 if (order != 3) {
59 printf("[%d] line mod quad order=%d\n", (int) index, order);
60 }
61 }
62 }
63
64 void QuadraticReduceOrder_Test() {
65 oneOffTest();
66 standardTestCases();
67 }
OLDNEW
« no previous file with comments | « experimental/Intersection/QuadraticReduceOrder.cpp ('k') | experimental/Intersection/QuadraticSubDivide.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698