| 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 "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" | 
| 8 #include "PathOpsThreadedCommon.h" | 8 #include "PathOpsThreadedCommon.h" | 
| 9 #include "SkIntersections.h" | 9 #include "SkIntersections.h" | 
| 10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 48             quad[1].fY, quad[2].fX, quad[2].fY); | 48             quad[1].fY, quad[2].fX, quad[2].fY); | 
| 49     str += sprintf(str, "    path.moveTo(%1.9g, %1.9g);\n", line[0].fX, line[0].
     fY); | 49     str += sprintf(str, "    path.moveTo(%1.9g, %1.9g);\n", line[0].fX, line[0].
     fY); | 
| 50     str += sprintf(str, "    path.lineTo(%1.9g, %1.9g);\n", line[1].fX, line[1].
     fY); | 50     str += sprintf(str, "    path.lineTo(%1.9g, %1.9g);\n", line[1].fX, line[1].
     fY); | 
| 51 | 51 | 
| 52     SkIntersections intersections; | 52     SkIntersections intersections; | 
| 53     bool flipped = false; | 53     bool flipped = false; | 
| 54     int result = doIntersect(intersections, quad, line, flipped); | 54     int result = doIntersect(intersections, quad, line, flipped); | 
| 55     bool found = false; | 55     bool found = false; | 
| 56     for (int index = 0; index < result; ++index) { | 56     for (int index = 0; index < result; ++index) { | 
| 57         double quadT = intersections[0][index]; | 57         double quadT = intersections[0][index]; | 
| 58         SkDPoint quadXY = quad.xyAtT(quadT); | 58         SkDPoint quadXY = quad.ptAtT(quadT); | 
| 59         double lineT = intersections[1][index]; | 59         double lineT = intersections[1][index]; | 
| 60         SkDPoint lineXY = line.xyAtT(lineT); | 60         SkDPoint lineXY = line.ptAtT(lineT); | 
| 61         if (quadXY.approximatelyEqual(lineXY)) { | 61         if (quadXY.approximatelyEqual(lineXY)) { | 
| 62             found = true; | 62             found = true; | 
| 63         } | 63         } | 
| 64     } | 64     } | 
| 65     REPORTER_ASSERT(reporter, found); | 65     REPORTER_ASSERT(reporter, found); | 
| 66 } | 66 } | 
| 67 | 67 | 
| 68 | 68 | 
| 69 // find a point on a quad by choosing a t from 0 to 1 | 69 // find a point on a quad by choosing a t from 0 to 1 | 
| 70 // create a vertical span above and below the point | 70 // create a vertical span above and below the point | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 82     int cx = state.fC & 0x03; | 82     int cx = state.fC & 0x03; | 
| 83     int cy = state.fC >> 2; | 83     int cy = state.fC >> 2; | 
| 84     SkDQuad quad = {{{(double) ax, (double) ay}, {(double) bx, (double) by}, | 84     SkDQuad quad = {{{(double) ax, (double) ay}, {(double) bx, (double) by}, | 
| 85             {(double) cx, (double) cy}}}; | 85             {(double) cx, (double) cy}}}; | 
| 86     SkReduceOrder reducer; | 86     SkReduceOrder reducer; | 
| 87     int order = reducer.reduce(quad, SkReduceOrder::kFill_Style); | 87     int order = reducer.reduce(quad, SkReduceOrder::kFill_Style); | 
| 88     if (order < 3) { | 88     if (order < 3) { | 
| 89         return; | 89         return; | 
| 90     } | 90     } | 
| 91     for (int tIndex = 0; tIndex <= 4; ++tIndex) { | 91     for (int tIndex = 0; tIndex <= 4; ++tIndex) { | 
| 92         SkDPoint xy = quad.xyAtT(tIndex / 4.0); | 92         SkDPoint xy = quad.ptAtT(tIndex / 4.0); | 
| 93         for (int h = -2; h <= 2; ++h) { | 93         for (int h = -2; h <= 2; ++h) { | 
| 94             for (int v = -2; v <= 2; ++v) { | 94             for (int v = -2; v <= 2; ++v) { | 
| 95                 if (h == v && abs(h) != 1) { | 95                 if (h == v && abs(h) != 1) { | 
| 96                     continue; | 96                     continue; | 
| 97                 } | 97                 } | 
| 98                 double x = xy.fX; | 98                 double x = xy.fX; | 
| 99                 double y = xy.fY; | 99                 double y = xy.fY; | 
| 100                 SkDLine line = {{{x - h, y - v}, {x, y}}}; | 100                 SkDLine line = {{{x - h, y - v}, {x, y}}}; | 
| 101                 testLineIntersect(state.fReporter, quad, line, x, y); | 101                 testLineIntersect(state.fReporter, quad, line, x, y); | 
| 102                 state.fReporter->bumpTestCount(); | 102                 state.fReporter->bumpTestCount(); | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 123             } | 123             } | 
| 124             if (!reporter->allowExtendedTest()) goto finish; | 124             if (!reporter->allowExtendedTest()) goto finish; | 
| 125         } | 125         } | 
| 126     } | 126     } | 
| 127 finish: | 127 finish: | 
| 128     testRunner.render(); | 128     testRunner.render(); | 
| 129 } | 129 } | 
| 130 | 130 | 
| 131 #include "TestClassDef.h" | 131 #include "TestClassDef.h" | 
| 132 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionThreadedTest) | 132 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionThreadedTest) | 
| OLD | NEW | 
|---|