| OLD | NEW |
| 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 "SkLineParameters.h" | 7 #include "SkLineParameters.h" |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 | 9 |
| 10 // tests to verify that distance calculations are coded correctly | 10 // tests to verify that distance calculations are coded correctly |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 distSq, answersSq, normalSquared); | 61 distSq, answersSq, normalSquared); |
| 62 } | 62 } |
| 63 lineParameters.normalize(); | 63 lineParameters.normalize(); |
| 64 double normalizedDistance[2]; | 64 double normalizedDistance[2]; |
| 65 normalizedDistance[0] = lineParameters.controlPtDistance(cubic, 1); | 65 normalizedDistance[0] = lineParameters.controlPtDistance(cubic, 1); |
| 66 normalizedDistance[1] = lineParameters.controlPtDistance(cubic, 2); | 66 normalizedDistance[1] = lineParameters.controlPtDistance(cubic, 2); |
| 67 for (inner = 0; inner < 2; ++inner) { | 67 for (inner = 0; inner < 2; ++inner) { |
| 68 if (AlmostEqualUlps(fabs(normalizedDistance[inner]), answers[index][
inner])) { | 68 if (AlmostEqualUlps(fabs(normalizedDistance[inner]), answers[index][
inner])) { |
| 69 continue; | 69 continue; |
| 70 } | 70 } |
| 71 SkDebugf("%s [%d,%d] normalizedDistance:%1.10g != answer:%g\n", | 71 SkDebugf("%s [%d,%d] normalizedDistance:%1.9g != answer:%g\n", |
| 72 __FUNCTION__, static_cast<int>(index), (int)inner, | 72 __FUNCTION__, static_cast<int>(index), (int)inner, |
| 73 normalizedDistance[inner], answers[index][inner]); | 73 normalizedDistance[inner], answers[index][inner]); |
| 74 REPORTER_ASSERT(reporter, 0); | 74 REPORTER_ASSERT(reporter, 0); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 #include "TestClassDef.h" | 79 #include "TestClassDef.h" |
| 80 DEFINE_TESTCLASS_SHORT(PathOpsLineParametersTest) | 80 DEFINE_TESTCLASS_SHORT(PathOpsLineParametersTest) |
| OLD | NEW |