OLD | NEW |
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 "SkPathOpsCubic.h" | 9 #include "SkPathOpsCubic.h" |
10 #include "SkPathOpsQuad.h" | 10 #include "SkPathOpsQuad.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 static void PathOpsCubicQuadIntersectionTest(skiatest::Reporter* reporter) { | 53 static void PathOpsCubicQuadIntersectionTest(skiatest::Reporter* reporter) { |
54 for (size_t index = 0; index < quadCubicTests_count; ++index) { | 54 for (size_t index = 0; index < quadCubicTests_count; ++index) { |
55 int iIndex = static_cast<int>(index); | 55 int iIndex = static_cast<int>(index); |
56 const SkDCubic& cubic = quadCubicTests[index].cubic; | 56 const SkDCubic& cubic = quadCubicTests[index].cubic; |
57 SkASSERT(ValidCubic(cubic)); | 57 SkASSERT(ValidCubic(cubic)); |
58 const SkDQuad& quad = quadCubicTests[index].quad; | 58 const SkDQuad& quad = quadCubicTests[index].quad; |
59 SkASSERT(ValidQuad(quad)); | 59 SkASSERT(ValidQuad(quad)); |
60 SkReduceOrder reduce1; | 60 SkReduceOrder reduce1; |
61 SkReduceOrder reduce2; | 61 SkReduceOrder reduce2; |
62 int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics, | 62 int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics); |
63 SkReduceOrder::kFill_Style); | 63 int order2 = reduce2.reduce(quad); |
64 int order2 = reduce2.reduce(quad, SkReduceOrder::kFill_Style); | |
65 if (order1 != 4) { | 64 if (order1 != 4) { |
66 SkDebugf("[%d] cubic order=%d\n", iIndex, order1); | 65 SkDebugf("[%d] cubic order=%d\n", iIndex, order1); |
67 REPORTER_ASSERT(reporter, 0); | 66 REPORTER_ASSERT(reporter, 0); |
68 } | 67 } |
69 if (order2 != 3) { | 68 if (order2 != 3) { |
70 SkDebugf("[%d] quad order=%d\n", iIndex, order2); | 69 SkDebugf("[%d] quad order=%d\n", iIndex, order2); |
71 REPORTER_ASSERT(reporter, 0); | 70 REPORTER_ASSERT(reporter, 0); |
72 } | 71 } |
73 SkIntersections i; | 72 SkIntersections i; |
74 int roots = i.intersect(cubic, quad); | 73 int roots = i.intersect(cubic, quad); |
(...skipping 17 matching lines...) Expand all Loading... |
92 __FUNCTION__, iIndex, pt, xy1.fX, xy1.fY); | 91 __FUNCTION__, iIndex, pt, xy1.fX, xy1.fY); |
93 } | 92 } |
94 REPORTER_ASSERT(reporter, found); | 93 REPORTER_ASSERT(reporter, found); |
95 } | 94 } |
96 reporter->bumpTestCount(); | 95 reporter->bumpTestCount(); |
97 } | 96 } |
98 } | 97 } |
99 | 98 |
100 #include "TestClassDef.h" | 99 #include "TestClassDef.h" |
101 DEFINE_TESTCLASS_SHORT(PathOpsCubicQuadIntersectionTest) | 100 DEFINE_TESTCLASS_SHORT(PathOpsCubicQuadIntersectionTest) |
OLD | NEW |