Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: tests/PathOpsQuadLineIntersectionThreadedTest.cpp

Issue 2426173002: fix fuzzers (Closed)
Patch Set: fix dm Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PathOpsQuadLineIntersectionTest.cpp ('k') | tests/PathOpsQuadReduceOrderTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « tests/PathOpsQuadLineIntersectionTest.cpp ('k') | tests/PathOpsQuadReduceOrderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698