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

Side by Side Diff: tests/PathOpsCubicLineIntersectionTest.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
« no previous file with comments | « tests/PathOpsCubicIntersectionTest.cpp ('k') | tests/PathOpsCubicQuadIntersectionTest.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 "PathOpsTestCommon.h" 7 #include "PathOpsTestCommon.h"
8 #include "SkIntersections.h" 8 #include "SkIntersections.h"
9 #include "SkPathOpsCubic.h" 9 #include "SkPathOpsCubic.h"
10 #include "SkPathOpsLine.h" 10 #include "SkPathOpsLine.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 if (order2 < 2) { 48 if (order2 < 2) {
49 SkDebugf("[%d] line order=%d\n", iIndex, order2); 49 SkDebugf("[%d] line order=%d\n", iIndex, order2);
50 REPORTER_ASSERT(reporter, 0); 50 REPORTER_ASSERT(reporter, 0);
51 } 51 }
52 if (order1 == 4 && order2 == 2) { 52 if (order1 == 4 && order2 == 2) {
53 SkIntersections i; 53 SkIntersections i;
54 int roots = i.intersect(cubic, line); 54 int roots = i.intersect(cubic, line);
55 for (int pt = 0; pt < roots; ++pt) { 55 for (int pt = 0; pt < roots; ++pt) {
56 double tt1 = i[0][pt]; 56 double tt1 = i[0][pt];
57 SkDPoint xy1 = cubic.xyAtT(tt1); 57 SkDPoint xy1 = cubic.ptAtT(tt1);
58 double tt2 = i[1][pt]; 58 double tt2 = i[1][pt];
59 SkDPoint xy2 = line.xyAtT(tt2); 59 SkDPoint xy2 = line.ptAtT(tt2);
60 if (!xy1.approximatelyEqual(xy2)) { 60 if (!xy1.approximatelyEqual(xy2)) {
61 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", 61 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n",
62 __FUNCTION__, iIndex, pt, tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); 62 __FUNCTION__, iIndex, pt, tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY);
63 } 63 }
64 REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2)); 64 REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2));
65 } 65 }
66 } 66 }
67 } 67 }
68 68
69 static void PathOpsCubicLineIntersectionTest(skiatest::Reporter* reporter) { 69 static void PathOpsCubicLineIntersectionTest(skiatest::Reporter* reporter) {
70 for (size_t index = 0; index < lineCubicTests_count; ++index) { 70 for (size_t index = 0; index < lineCubicTests_count; ++index) {
71 int iIndex = static_cast<int>(index); 71 int iIndex = static_cast<int>(index);
72 testOne(reporter, iIndex); 72 testOne(reporter, iIndex);
73 reporter->bumpTestCount(); 73 reporter->bumpTestCount();
74 } 74 }
75 } 75 }
76 76
77 static void PathOpsCubicLineIntersectionOneOffTest(skiatest::Reporter* reporter) { 77 static void PathOpsCubicLineIntersectionOneOffTest(skiatest::Reporter* reporter) {
78 int iIndex = 0; 78 int iIndex = 0;
79 testOne(reporter, iIndex); 79 testOne(reporter, iIndex);
80 const SkDCubic& cubic = lineCubicTests[iIndex].cubic; 80 const SkDCubic& cubic = lineCubicTests[iIndex].cubic;
81 const SkDLine& line = lineCubicTests[iIndex].line; 81 const SkDLine& line = lineCubicTests[iIndex].line;
82 SkIntersections i; 82 SkIntersections i;
83 i.intersect(cubic, line); 83 i.intersect(cubic, line);
84 SkASSERT(i.used() == 1); 84 SkASSERT(i.used() == 1);
85 #if ONE_OFF_DEBUG 85 #if ONE_OFF_DEBUG
86 double cubicT = i[0][0]; 86 double cubicT = i[0][0];
87 SkDPoint prev = cubic.xyAtT(cubicT * 2 - 1); 87 SkDPoint prev = cubic.ptAtT(cubicT * 2 - 1);
88 SkDPoint sect = cubic.xyAtT(cubicT); 88 SkDPoint sect = cubic.ptAtT(cubicT);
89 double left[3] = { line.isLeft(prev), line.isLeft(sect), line.isLeft(cubic[3 ]) }; 89 double left[3] = { line.isLeft(prev), line.isLeft(sect), line.isLeft(cubic[3 ]) };
90 SkDebugf("cubic=(%1.9g, %1.9g, %1.9g)\n", left[0], left[1], left[2]); 90 SkDebugf("cubic=(%1.9g, %1.9g, %1.9g)\n", left[0], left[1], left[2]);
91 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prev.fX, prev.fY, sect.fX, sec t.fY); 91 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prev.fX, prev.fY, sect.fX, sec t.fY);
92 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", sect.fX, sect.fY, cubic[3].fX, cubic[3].fY); 92 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", sect.fX, sect.fY, cubic[3].fX, cubic[3].fY);
93 SkDPoint prevL = line.xyAtT(i[1][0] - 0.0000007); 93 SkDPoint prevL = line.ptAtT(i[1][0] - 0.0000007);
94 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prevL.fX, prevL.fY, i.pt(0).fX , i.pt(0).fY); 94 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", prevL.fX, prevL.fY, i.pt(0).fX , i.pt(0).fY);
95 SkDPoint nextL = line.xyAtT(i[1][0] + 0.0000007); 95 SkDPoint nextL = line.ptAtT(i[1][0] + 0.0000007);
96 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", i.pt(0).fX, i.pt(0).fY, nextL. fX, nextL.fY); 96 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", i.pt(0).fX, i.pt(0).fY, nextL. fX, nextL.fY);
97 SkDebugf("prevD=%1.9g dist=%1.9g nextD=%1.9g\n", prev.distance(nextL), 97 SkDebugf("prevD=%1.9g dist=%1.9g nextD=%1.9g\n", prev.distance(nextL),
98 sect.distance(i.pt(0)), cubic[3].distance(prevL)); 98 sect.distance(i.pt(0)), cubic[3].distance(prevL));
99 #endif 99 #endif
100 } 100 }
101 101
102 #include "TestClassDef.h" 102 #include "TestClassDef.h"
103 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionTest) 103 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionTest)
104 104
105 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionOneOffTest) 105 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionOneOffTest)
OLDNEW
« no previous file with comments | « tests/PathOpsCubicIntersectionTest.cpp ('k') | tests/PathOpsCubicQuadIntersectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698