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

Side by Side Diff: tests/PathOpsQuadLineIntersectionTest.cpp

Issue 19543005: turn off debugging printfs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove unused code Created 7 years, 5 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 | Annotate | Revision Log
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 "PathOpsExtendedTest.h" 7 #include "PathOpsExtendedTest.h"
8 #include "PathOpsTestCommon.h" 8 #include "PathOpsTestCommon.h"
9 #include "SkIntersections.h" 9 #include "SkIntersections.h"
10 #include "SkPathOpsLine.h" 10 #include "SkPathOpsLine.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bool flipped = false; 73 bool flipped = false;
74 for (size_t index = 0; index < oneOffs_count; ++index) { 74 for (size_t index = 0; index < oneOffs_count; ++index) {
75 const SkDQuad& quad = oneOffs[index].quad; 75 const SkDQuad& quad = oneOffs[index].quad;
76 SkASSERT(ValidQuad(quad)); 76 SkASSERT(ValidQuad(quad));
77 const SkDLine& line = oneOffs[index].line; 77 const SkDLine& line = oneOffs[index].line;
78 SkASSERT(ValidLine(line)); 78 SkASSERT(ValidLine(line));
79 SkIntersections intersections; 79 SkIntersections intersections;
80 int result = doIntersect(intersections, quad, line, flipped); 80 int result = doIntersect(intersections, quad, line, flipped);
81 for (int inner = 0; inner < result; ++inner) { 81 for (int inner = 0; inner < result; ++inner) {
82 double quadT = intersections[0][inner]; 82 double quadT = intersections[0][inner];
83 SkDPoint quadXY = quad.xyAtT(quadT); 83 SkDPoint quadXY = quad.ptAtT(quadT);
84 double lineT = intersections[1][inner]; 84 double lineT = intersections[1][inner];
85 SkDPoint lineXY = line.xyAtT(lineT); 85 SkDPoint lineXY = line.ptAtT(lineT);
86 REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY)); 86 REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY));
87 } 87 }
88 } 88 }
89 } 89 }
90 90
91 static void PathOpsQuadLineIntersectionTestOne(skiatest::Reporter* reporter) { 91 static void PathOpsQuadLineIntersectionTestOne(skiatest::Reporter* reporter) {
92 testOneOffs(reporter); 92 testOneOffs(reporter);
93 } 93 }
94 94
95 static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) { 95 static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) {
(...skipping 17 matching lines...) Expand all
113 SkIntersections intersections; 113 SkIntersections intersections;
114 bool flipped = false; 114 bool flipped = false;
115 int result = doIntersect(intersections, quad, line, flipped); 115 int result = doIntersect(intersections, quad, line, flipped);
116 REPORTER_ASSERT(reporter, result == lineQuadTests[index].result); 116 REPORTER_ASSERT(reporter, result == lineQuadTests[index].result);
117 if (intersections.used() <= 0) { 117 if (intersections.used() <= 0) {
118 continue; 118 continue;
119 } 119 }
120 for (int pt = 0; pt < result; ++pt) { 120 for (int pt = 0; pt < result; ++pt) {
121 double tt1 = intersections[0][pt]; 121 double tt1 = intersections[0][pt];
122 REPORTER_ASSERT(reporter, tt1 >= 0 && tt1 <= 1); 122 REPORTER_ASSERT(reporter, tt1 >= 0 && tt1 <= 1);
123 SkDPoint t1 = quad.xyAtT(tt1); 123 SkDPoint t1 = quad.ptAtT(tt1);
124 double tt2 = intersections[1][pt]; 124 double tt2 = intersections[1][pt];
125 REPORTER_ASSERT(reporter, tt2 >= 0 && tt2 <= 1); 125 REPORTER_ASSERT(reporter, tt2 >= 0 && tt2 <= 1);
126 SkDPoint t2 = line.xyAtT(tt2); 126 SkDPoint t2 = line.ptAtT(tt2);
127 if (!t1.approximatelyEqual(t2)) { 127 if (!t1.approximatelyEqual(t2)) {
128 SkDebugf("%s [%d,%d] x!= t1=%1.9g (%1.9g,%1.9g) t2=%1.9g (%1.9g, %1.9g)\n", 128 SkDebugf("%s [%d,%d] x!= t1=%1.9g (%1.9g,%1.9g) t2=%1.9g (%1.9g, %1.9g)\n",
129 __FUNCTION__, iIndex, pt, tt1, t1.fX, t1.fY, tt2, t2.fX, t2. fY); 129 __FUNCTION__, iIndex, pt, tt1, t1.fX, t1.fY, tt2, t2.fX, t2. fY);
130 REPORTER_ASSERT(reporter, 0); 130 REPORTER_ASSERT(reporter, 0);
131 } 131 }
132 if (!t1.approximatelyEqual(lineQuadTests[index].expected[0]) 132 if (!t1.approximatelyEqual(lineQuadTests[index].expected[0])
133 && (lineQuadTests[index].result == 1 133 && (lineQuadTests[index].result == 1
134 || !t1.approximatelyEqual(lineQuadTests[index].expected[1])) ) { 134 || !t1.approximatelyEqual(lineQuadTests[index].expected[1])) ) {
135 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY); 135 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY);
136 REPORTER_ASSERT(reporter, 0); 136 REPORTER_ASSERT(reporter, 0);
137 } 137 }
138 } 138 }
139 } 139 }
140 } 140 }
141 141
142 #include "TestClassDef.h" 142 #include "TestClassDef.h"
143 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest) 143 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest)
144 144
145 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTestOne) 145 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTestOne)
OLDNEW
« no previous file with comments | « tests/PathOpsQuadIntersectionTest.cpp ('k') | tests/PathOpsQuadLineIntersectionThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698