| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 SkASSERT(ValidCubic(cubic)); | 165 SkASSERT(ValidCubic(cubic)); |
| 166 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); | 166 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); |
| 167 if (order != 2) { | 167 if (order != 2) { |
| 168 SkDebugf("[%d] line neg by epsilon/2 order=%d\n", static_cast<int>(i
ndex), order); | 168 SkDebugf("[%d] line neg by epsilon/2 order=%d\n", static_cast<int>(i
ndex), order); |
| 169 REPORTER_ASSERT(reporter, 0); | 169 REPORTER_ASSERT(reporter, 0); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 for (index = firstQuadraticPointTest; index < quadraticPoints_count; ++index
) { | 172 for (index = firstQuadraticPointTest; index < quadraticPoints_count; ++index
) { |
| 173 const SkDQuad& quad = quadraticPoints[index]; | 173 const SkDQuad& quad = quadraticPoints[index]; |
| 174 SkASSERT(ValidQuad(quad)); | 174 SkASSERT(ValidQuad(quad)); |
| 175 SkDCubic cubic = quad.toCubic(); | 175 SkDCubic cubic = quad.debugToCubic(); |
| 176 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); | 176 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); |
| 177 if (order != 1) { | 177 if (order != 1) { |
| 178 SkDebugf("[%d] point quad order=%d\n", static_cast<int>(index), orde
r); | 178 SkDebugf("[%d] point quad order=%d\n", static_cast<int>(index), orde
r); |
| 179 REPORTER_ASSERT(reporter, 0); | 179 REPORTER_ASSERT(reporter, 0); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index)
{ | 182 for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index)
{ |
| 183 const SkDQuad& quad = quadraticLines[index]; | 183 const SkDQuad& quad = quadraticLines[index]; |
| 184 SkASSERT(ValidQuad(quad)); | 184 SkASSERT(ValidQuad(quad)); |
| 185 SkDCubic cubic = quad.toCubic(); | 185 SkDCubic cubic = quad.debugToCubic(); |
| 186 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); | 186 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); |
| 187 if (order != 2) { | 187 if (order != 2) { |
| 188 SkDebugf("[%d] line quad order=%d\n", static_cast<int>(index), order
); | 188 SkDebugf("[%d] line quad order=%d\n", static_cast<int>(index), order
); |
| 189 REPORTER_ASSERT(reporter, 0); | 189 REPORTER_ASSERT(reporter, 0); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_cou
nt; ++index) { | 192 for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_cou
nt; ++index) { |
| 193 const SkDQuad& quad = quadraticModEpsilonLines[index]; | 193 const SkDQuad& quad = quadraticModEpsilonLines[index]; |
| 194 SkASSERT(ValidQuad(quad)); | 194 SkASSERT(ValidQuad(quad)); |
| 195 SkDCubic cubic = quad.toCubic(); | 195 SkDCubic cubic = quad.debugToCubic(); |
| 196 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); | 196 order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics); |
| 197 if (order != 3) { | 197 if (order != 3) { |
| 198 SkDebugf("[%d] line mod quad order=%d\n", static_cast<int>(index), o
rder); | 198 SkDebugf("[%d] line mod quad order=%d\n", static_cast<int>(index), o
rder); |
| 199 REPORTER_ASSERT(reporter, 0); | 199 REPORTER_ASSERT(reporter, 0); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 #if 0 // disable test until stroke reduction is supported | 203 #if 0 // disable test until stroke reduction is supported |
| 204 // test if computed line end points are valid | 204 // test if computed line end points are valid |
| 205 for (index = firstComputedLinesTest; index < lines_count; ++index) { | 205 for (index = firstComputedLinesTest; index < lines_count; ++index) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 233 && !AlmostEqualUlps(reducer.fLine[1].fX, bounds.fRight)) | 233 && !AlmostEqualUlps(reducer.fLine[1].fX, bounds.fRight)) |
| 234 || (!AlmostEqualUlps(reducer.fLine[1].fY, bounds.fTop) | 234 || (!AlmostEqualUlps(reducer.fLine[1].fY, bounds.fTop) |
| 235 && !AlmostEqualUlps(reducer.fLine[1].fY, bounds.fBottom))) { | 235 && !AlmostEqualUlps(reducer.fLine[1].fY, bounds.fBottom))) { |
| 236 SkDebugf("[%d] line computed tight bounds order=%d\n", static_ca
st<int>(index), order); | 236 SkDebugf("[%d] line computed tight bounds order=%d\n", static_ca
st<int>(index), order); |
| 237 REPORTER_ASSERT(reporter, 0); | 237 REPORTER_ASSERT(reporter, 0); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 #endif | 241 #endif |
| 242 } | 242 } |
| OLD | NEW |