| 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 "PathOpsCubicIntersectionTestData.h" | 7 #include "PathOpsCubicIntersectionTestData.h" |
| 8 #include "PathOpsQuadIntersectionTestData.h" | 8 #include "PathOpsQuadIntersectionTestData.h" |
| 9 #include "PathOpsTestCommon.h" | 9 #include "PathOpsTestCommon.h" |
| 10 #include "SkIntersections.h" | 10 #include "SkIntersections.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 SkDebugf("[%d] pointDegenerates order=%d\n", static_cast<int>(index)
, order); | 109 SkDebugf("[%d] pointDegenerates order=%d\n", static_cast<int>(index)
, order); |
| 110 REPORTER_ASSERT(reporter, 0); | 110 REPORTER_ASSERT(reporter, 0); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 for (index = firstNotPointDegeneratesTest; index < notPointDegenerates_count
; ++index) { | 113 for (index = firstNotPointDegeneratesTest; index < notPointDegenerates_count
; ++index) { |
| 114 const SkDCubic& cubic = notPointDegenerates[index]; | 114 const SkDCubic& cubic = notPointDegenerates[index]; |
| 115 SkASSERT(ValidCubic(cubic)); | 115 SkASSERT(ValidCubic(cubic)); |
| 116 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); | 116 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); |
| 117 if (order == 1) { | 117 if (order == 1) { |
| 118 SkDebugf("[%d] notPointDegenerates order=%d\n", static_cast<int>(ind
ex), order); | 118 SkDebugf("[%d] notPointDegenerates order=%d\n", static_cast<int>(ind
ex), order); |
| 119 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, |
| 120 SkReduceOrder::kFill_Style); |
| 119 REPORTER_ASSERT(reporter, 0); | 121 REPORTER_ASSERT(reporter, 0); |
| 120 } | 122 } |
| 121 } | 123 } |
| 122 for (index = firstLinesTest; index < lines_count; ++index) { | 124 for (index = firstLinesTest; index < lines_count; ++index) { |
| 123 const SkDCubic& cubic = lines[index]; | 125 const SkDCubic& cubic = lines[index]; |
| 124 SkASSERT(ValidCubic(cubic)); | 126 SkASSERT(ValidCubic(cubic)); |
| 125 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); | 127 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); |
| 126 if (order != 2) { | 128 if (order != 2) { |
| 127 SkDebugf("[%d] lines order=%d\n", static_cast<int>(index), order); | 129 SkDebugf("[%d] lines order=%d\n", static_cast<int>(index), order); |
| 128 REPORTER_ASSERT(reporter, 0); | 130 REPORTER_ASSERT(reporter, 0); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 145 SkDebugf("[%d] line mod by epsilon order=%d\n", static_cast<int>(ind
ex), order); | 147 SkDebugf("[%d] line mod by epsilon order=%d\n", static_cast<int>(ind
ex), order); |
| 146 REPORTER_ASSERT(reporter, 0); | 148 REPORTER_ASSERT(reporter, 0); |
| 147 } | 149 } |
| 148 } | 150 } |
| 149 for (index = firstLessEpsilonTest; index < lessEpsilonLines_count; ++index)
{ | 151 for (index = firstLessEpsilonTest; index < lessEpsilonLines_count; ++index)
{ |
| 150 const SkDCubic& cubic = lessEpsilonLines[index]; | 152 const SkDCubic& cubic = lessEpsilonLines[index]; |
| 151 SkASSERT(ValidCubic(cubic)); | 153 SkASSERT(ValidCubic(cubic)); |
| 152 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); | 154 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); |
| 153 if (order != 2) { | 155 if (order != 2) { |
| 154 SkDebugf("[%d] line less by epsilon/2 order=%d\n", static_cast<int>(
index), order); | 156 SkDebugf("[%d] line less by epsilon/2 order=%d\n", static_cast<int>(
index), order); |
| 157 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, |
| 158 SkReduceOrder::kFill_Style); |
| 155 REPORTER_ASSERT(reporter, 0); | 159 REPORTER_ASSERT(reporter, 0); |
| 156 } | 160 } |
| 157 } | 161 } |
| 158 for (index = firstNegEpsilonTest; index < negEpsilonLines_count; ++index) { | 162 for (index = firstNegEpsilonTest; index < negEpsilonLines_count; ++index) { |
| 159 const SkDCubic& cubic = negEpsilonLines[index]; | 163 const SkDCubic& cubic = negEpsilonLines[index]; |
| 160 SkASSERT(ValidCubic(cubic)); | 164 SkASSERT(ValidCubic(cubic)); |
| 161 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); | 165 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduce
Order::kFill_Style); |
| 162 if (order != 2) { | 166 if (order != 2) { |
| 163 SkDebugf("[%d] line neg by epsilon/2 order=%d\n", static_cast<int>(i
ndex), order); | 167 SkDebugf("[%d] line neg by epsilon/2 order=%d\n", static_cast<int>(i
ndex), order); |
| 164 REPORTER_ASSERT(reporter, 0); | 168 REPORTER_ASSERT(reporter, 0); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 || (!AlmostEqualUlps(reducer.fLine[1].fY, bounds.fTop) | 232 || (!AlmostEqualUlps(reducer.fLine[1].fY, bounds.fTop) |
| 229 && !AlmostEqualUlps(reducer.fLine[1].fY, bounds.fBottom))) { | 233 && !AlmostEqualUlps(reducer.fLine[1].fY, bounds.fBottom))) { |
| 230 SkDebugf("[%d] line computed tight bounds order=%d\n", static_ca
st<int>(index), order); | 234 SkDebugf("[%d] line computed tight bounds order=%d\n", static_ca
st<int>(index), order); |
| 231 REPORTER_ASSERT(reporter, 0); | 235 REPORTER_ASSERT(reporter, 0); |
| 232 } | 236 } |
| 233 } | 237 } |
| 234 } | 238 } |
| 235 } | 239 } |
| 236 | 240 |
| 237 #include "TestClassDef.h" | 241 #include "TestClassDef.h" |
| 242 |
| 238 DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderCubicTest) | 243 DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderCubicTest) |
| OLD | NEW |