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

Side by Side Diff: tests/PathOpsAngleTest.cpp

Issue 1313203003: Remove include of stdlib.h from SkTypes.h. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up qsort conversion. Created 5 years, 3 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 | « src/utils/SkRTConf.cpp ('k') | tests/PathOpsCubicIntersectionTest.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 2013 Google Inc. 2 * Copyright 2013 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 "SkOpContour.h" 9 #include "SkOpContour.h"
10 #include "SkOpSegment.h" 10 #include "SkOpSegment.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 SkPoint pt = dPt.asSkPoint(); 44 SkPoint pt = dPt.asSkPoint();
45 float xs[3] = { prev(pt.fX), pt.fX, next(pt.fX) }; 45 float xs[3] = { prev(pt.fX), pt.fX, next(pt.fX) };
46 float ys[3] = { prev(pt.fY), pt.fY, next(pt.fY) }; 46 float ys[3] = { prev(pt.fY), pt.fY, next(pt.fY) };
47 for (int xIdx = 0; xIdx < 3; ++xIdx) { 47 for (int xIdx = 0; xIdx < 3; ++xIdx) {
48 for (int yIdx = 0; yIdx < 3; ++yIdx) { 48 for (int yIdx = 0; yIdx < 3; ++yIdx) {
49 SkPoint test = { xs[xIdx], ys[yIdx] }; 49 SkPoint test = { xs[xIdx], ys[yIdx] };
50 float p1 = SkDoubleToScalar(line[1].fX * test.fY); 50 float p1 = SkDoubleToScalar(line[1].fX * test.fY);
51 float p2 = SkDoubleToScalar(line[1].fY * test.fX); 51 float p2 = SkDoubleToScalar(line[1].fY * test.fX);
52 int p1Bits = SkFloatAs2sCompliment(p1); 52 int p1Bits = SkFloatAs2sCompliment(p1);
53 int p2Bits = SkFloatAs2sCompliment(p2); 53 int p2Bits = SkFloatAs2sCompliment(p2);
54 int epsilon = abs(p1Bits - p2Bits); 54 int epsilon = SkTAbs(p1Bits - p2Bits);
55 if (maxEpsilon < epsilon) { 55 if (maxEpsilon < epsilon) {
56 SkDebugf("line={{0, 0}, {%1.7g, %1.7g}} t=%1.7g pt={%1.7 g, %1.7g}" 56 SkDebugf("line={{0, 0}, {%1.7g, %1.7g}} t=%1.7g pt={%1.7 g, %1.7g}"
57 " epsilon=%d\n", 57 " epsilon=%d\n",
58 line[1].fX, line[1].fY, t, test.fX, test.fY, epsilon ); 58 line[1].fX, line[1].fY, t, test.fX, test.fY, epsilon );
59 maxEpsilon = epsilon; 59 maxEpsilon = epsilon;
60 } 60 }
61 } 61 }
62 } 62 }
63 } 63 }
64 } 64 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 moveT += deltaT; 97 moveT += deltaT;
98 } else { 98 } else {
99 moveT -= deltaT; 99 moveT -= deltaT;
100 } 100 }
101 deltaT /= 2; 101 deltaT /= 2;
102 } while (last.asSkPoint() != quad[1].asSkPoint()); 102 } while (last.asSkPoint() != quad[1].asSkPoint());
103 float p1 = SkDoubleToScalar(line[1].fX * last.fY); 103 float p1 = SkDoubleToScalar(line[1].fX * last.fY);
104 float p2 = SkDoubleToScalar(line[1].fY * last.fX); 104 float p2 = SkDoubleToScalar(line[1].fY * last.fX);
105 int p1Bits = SkFloatAs2sCompliment(p1); 105 int p1Bits = SkFloatAs2sCompliment(p1);
106 int p2Bits = SkFloatAs2sCompliment(p2); 106 int p2Bits = SkFloatAs2sCompliment(p2);
107 int epsilon = abs(p1Bits - p2Bits); 107 int epsilon = SkTAbs(p1Bits - p2Bits);
108 if (maxEpsilon < epsilon) { 108 if (maxEpsilon < epsilon) {
109 SkDebugf("line={{0, 0}, {%1.7g, %1.7g}} t=%1.7g/%1.7g/%1.7g moveT=%1 .7g" 109 SkDebugf("line={{0, 0}, {%1.7g, %1.7g}} t=%1.7g/%1.7g/%1.7g moveT=%1 .7g"
110 " pt={%1.7g, %1.7g} epsilon=%d\n", 110 " pt={%1.7g, %1.7g} epsilon=%d\n",
111 line[1].fX, line[1].fY, t, t2, t3, moveT, last.fX, last.fY, epsilon); 111 line[1].fX, line[1].fY, t, t2, t3, moveT, last.fX, last.fY, epsilon);
112 maxEpsilon = epsilon; 112 maxEpsilon = epsilon;
113 } 113 }
114 double a1 = atan2(line[1].fY, line[1].fX); 114 double a1 = atan2(line[1].fY, line[1].fX);
115 double a2 = atan2(last.fY, last.fX); 115 double a2 = atan2(last.fY, last.fX);
116 double angle = fabs(a1 - a2); 116 double angle = fabs(a1 - a2);
117 if (maxAngle < angle) { 117 if (maxAngle < angle) {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 488 }
489 angle->set(startSpan, endSpan); 489 angle->set(startSpan, endSpan);
490 if (startT < endT) { 490 if (startT < endT) {
491 startSpan->upCast()->setToAngle(angle); 491 startSpan->upCast()->setToAngle(angle);
492 endSpan->setFromAngle(angle); 492 endSpan->setFromAngle(angle);
493 } else { 493 } else {
494 endSpan->upCast()->setToAngle(angle); 494 endSpan->upCast()->setToAngle(angle);
495 startSpan->setFromAngle(angle); 495 startSpan->setFromAngle(angle);
496 } 496 }
497 } 497 }
OLDNEW
« no previous file with comments | « src/utils/SkRTConf.cpp ('k') | tests/PathOpsCubicIntersectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698