| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkPathOpsConic.h" | 9 #include "SkPathOpsConic.h" |
| 10 #include "SkPathOpsQuad.h" | 10 #include "SkPathOpsQuad.h" |
| 11 #include "SkReduceOrder.h" | 11 #include "SkReduceOrder.h" |
| 12 #include "Test.h" | 12 #include "Test.h" |
| 13 | 13 |
| 14 static struct conicQuad { | 14 static struct conicQuad { |
| 15 SkDConic conic; | 15 ConicPts conic; |
| 16 SkDQuad quad; | 16 QuadPts quad; |
| 17 } conicQuadTests[] = { | 17 } conicQuadTests[] = { |
| 18 {{{{{494.348663,224.583771}, {494.365143,224.633194}, {494.376404,224.684067}
}}, 0.998645842f}, | 18 {{{{{494.348663,224.583771}, {494.365143,224.633194}, {494.376404,224.684067}
}}, 0.998645842f}, |
| 19 {{{494.30481,224.474213}, {494.334961,224.538284}, {494.355774,224.605927}}}
}, | 19 {{{494.30481,224.474213}, {494.334961,224.538284}, {494.355774,224.605927}}}
}, |
| 20 | 20 |
| 21 {{{{{494.348663,224.583771}, {494.365143,224.633194}, {494.376404,224.684067}
}}, 0.998645842f}, | 21 {{{{{494.348663,224.583771}, {494.365143,224.633194}, {494.376404,224.684067}
}}, 0.998645842f}, |
| 22 {{{494.355774f, 224.605927f}, {494.363708f, 224.631714f}, {494.370148f, 224.
657471f}}}}, | 22 {{{494.355774f, 224.605927f}, {494.363708f, 224.631714f}, {494.370148f, 224.
657471f}}}}, |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 static const int conicQuadTests_count = (int) SK_ARRAY_COUNT(conicQuadTests); | 25 static const int conicQuadTests_count = (int) SK_ARRAY_COUNT(conicQuadTests); |
| 26 | 26 |
| 27 static void conicQuadIntersection(skiatest::Reporter* reporter, int index) { | 27 static void conicQuadIntersection(skiatest::Reporter* reporter, int index) { |
| 28 const SkDConic& conic = conicQuadTests[index].conic; | 28 const ConicPts& c = conicQuadTests[index].conic; |
| 29 SkDConic conic; |
| 30 conic.debugSet(c.fPts.fPts, c.fWeight); |
| 29 SkASSERT(ValidConic(conic)); | 31 SkASSERT(ValidConic(conic)); |
| 30 const SkDQuad& quad = conicQuadTests[index].quad; | 32 const QuadPts& q = conicQuadTests[index].quad; |
| 33 SkDQuad quad; |
| 34 quad.debugSet(q.fPts); |
| 31 SkASSERT(ValidQuad(quad)); | 35 SkASSERT(ValidQuad(quad)); |
| 32 SkReduceOrder reduce1; | 36 SkReduceOrder reduce1; |
| 33 SkReduceOrder reduce2; | 37 SkReduceOrder reduce2; |
| 34 int order1 = reduce2.reduce(conic.fPts); | 38 int order1 = reduce2.reduce(conic.fPts); |
| 35 int order2 = reduce1.reduce(quad); | 39 int order2 = reduce1.reduce(quad); |
| 36 if (order2 != 3) { | 40 if (order2 != 3) { |
| 37 SkDebugf("[%d] conic order=%d\n", index, order1); | 41 SkDebugf("[%d] conic order=%d\n", index, order1); |
| 38 REPORTER_ASSERT(reporter, 0); | 42 REPORTER_ASSERT(reporter, 0); |
| 39 } | 43 } |
| 40 if (order1 != 3) { | 44 if (order1 != 3) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 DEF_TEST(PathOpsConicQuadIntersection, reporter) { | 64 DEF_TEST(PathOpsConicQuadIntersection, reporter) { |
| 61 for (int index = 0; index < conicQuadTests_count; ++index) { | 65 for (int index = 0; index < conicQuadTests_count; ++index) { |
| 62 conicQuadIntersection(reporter, index); | 66 conicQuadIntersection(reporter, index); |
| 63 reporter->bumpTestCount(); | 67 reporter->bumpTestCount(); |
| 64 } | 68 } |
| 65 } | 69 } |
| 66 | 70 |
| 67 DEF_TEST(PathOpsConicQuadIntersectionOneOff, reporter) { | 71 DEF_TEST(PathOpsConicQuadIntersectionOneOff, reporter) { |
| 68 conicQuadIntersection(reporter, 1); | 72 conicQuadIntersection(reporter, 1); |
| 69 } | 73 } |
| OLD | NEW |