| 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 "PathOpsTestCommon.h" |
| 8 #include "PathOpsThreadedCommon.h" | 9 #include "PathOpsThreadedCommon.h" |
| 9 #include "SkIntersections.h" | 10 #include "SkIntersections.h" |
| 10 #include "SkPathOpsLine.h" | 11 #include "SkPathOpsLine.h" |
| 11 #include "SkPathOpsQuad.h" | 12 #include "SkPathOpsQuad.h" |
| 12 #include "SkReduceOrder.h" | 13 #include "SkReduceOrder.h" |
| 13 #include "SkString.h" | 14 #include "SkString.h" |
| 14 | 15 |
| 15 static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, cons
t SkDLine& line, | 16 static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, cons
t SkDLine& line, |
| 16 bool& flipped) { | 17 bool& flipped) { |
| 17 int result; | 18 int result; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static void testQuadLineIntersectMain(PathOpsThreadState* data) | 73 static void testQuadLineIntersectMain(PathOpsThreadState* data) |
| 73 { | 74 { |
| 74 PathOpsThreadState& state = *data; | 75 PathOpsThreadState& state = *data; |
| 75 REPORTER_ASSERT(state.fReporter, data); | 76 REPORTER_ASSERT(state.fReporter, data); |
| 76 int ax = state.fA & 0x03; | 77 int ax = state.fA & 0x03; |
| 77 int ay = state.fA >> 2; | 78 int ay = state.fA >> 2; |
| 78 int bx = state.fB & 0x03; | 79 int bx = state.fB & 0x03; |
| 79 int by = state.fB >> 2; | 80 int by = state.fB >> 2; |
| 80 int cx = state.fC & 0x03; | 81 int cx = state.fC & 0x03; |
| 81 int cy = state.fC >> 2; | 82 int cy = state.fC >> 2; |
| 82 SkDQuad quad = {{{(double) ax, (double) ay}, {(double) bx, (double) by}, | 83 QuadPts q = {{{(double) ax, (double) ay}, {(double) bx, (double) by}, |
| 83 {(double) cx, (double) cy}}}; | 84 {(double) cx, (double) cy}}}; |
| 85 SkDQuad quad; |
| 86 quad.debugSet(q.fPts); |
| 84 SkReduceOrder reducer; | 87 SkReduceOrder reducer; |
| 85 int order = reducer.reduce(quad); | 88 int order = reducer.reduce(quad); |
| 86 if (order < 3) { | 89 if (order < 3) { |
| 87 return; | 90 return; |
| 88 } | 91 } |
| 89 for (int tIndex = 0; tIndex <= 4; ++tIndex) { | 92 for (int tIndex = 0; tIndex <= 4; ++tIndex) { |
| 90 SkDPoint xy = quad.ptAtT(tIndex / 4.0); | 93 SkDPoint xy = quad.ptAtT(tIndex / 4.0); |
| 91 for (int h = -2; h <= 2; ++h) { | 94 for (int h = -2; h <= 2; ++h) { |
| 92 for (int v = -2; v <= 2; ++v) { | 95 for (int v = -2; v <= 2; ++v) { |
| 93 if (h == v && SkTAbs(h) != 1) { | 96 if (h == v && SkTAbs(h) != 1) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 117 for (int c = 0 ; c < 16; ++c) { | 120 for (int c = 0 ; c < 16; ++c) { |
| 118 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable( | 121 *testRunner.fRunnables.append() = new PathOpsThreadedRunnable( |
| 119 &testQuadLineIntersectMain, a, b, c, 0, &testRunner); | 122 &testQuadLineIntersectMain, a, b, c, 0, &testRunner); |
| 120 } | 123 } |
| 121 if (!reporter->allowExtendedTest()) goto finish; | 124 if (!reporter->allowExtendedTest()) goto finish; |
| 122 } | 125 } |
| 123 } | 126 } |
| 124 finish: | 127 finish: |
| 125 testRunner.render(); | 128 testRunner.render(); |
| 126 } | 129 } |
| OLD | NEW |