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

Side by Side Diff: tests/PathOpsTightBoundsTest.cpp

Issue 2394443004: tight bounds optimization (Closed)
Patch Set: fix reversed boolean logic 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 | « src/pathops/SkPathOpsTightBounds.cpp ('k') | no next file » | 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 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 "PathOpsExtendedTest.h" 7 #include "PathOpsExtendedTest.h"
8 #include "PathOpsThreadedCommon.h" 8 #include "PathOpsThreadedCommon.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 PathOpsThreadedTestRunner testRunner(reporter); 113 PathOpsThreadedTestRunner testRunner(reporter);
114 int outerCount = reporter->allowExtendedTest() ? 100 : 1; 114 int outerCount = reporter->allowExtendedTest() ? 100 : 1;
115 for (int index = 0; index < outerCount; ++index) { 115 for (int index = 0; index < outerCount; ++index) {
116 for (int idx2 = 0; idx2 < 10; ++idx2) { 116 for (int idx2 = 0; idx2 < 10; ++idx2) {
117 *testRunner.fRunnables.append() = 117 *testRunner.fRunnables.append() =
118 new PathOpsThreadedRunnable(&testTightBoundsQuads, 0, 0, 0, 0, &testRunner); 118 new PathOpsThreadedRunnable(&testTightBoundsQuads, 0, 0, 0, 0, &testRunner);
119 } 119 }
120 } 120 }
121 testRunner.render(); 121 testRunner.render();
122 } 122 }
123
124 DEF_TEST(PathOpsTightBoundsMove, reporter) {
125 SkPath path;
126 path.moveTo(10, 10);
127 path.close();
128 path.moveTo(20, 20);
129 path.lineTo(20, 20);
130 path.close();
131 path.moveTo(15, 15);
132 path.lineTo(15, 15);
133 path.close();
134 const SkRect& bounds = path.getBounds();
135 SkRect tight;
136 REPORTER_ASSERT(reporter, TightBounds(path, &tight));
137 REPORTER_ASSERT(reporter, bounds == tight);
138 }
139
140 DEF_TEST(PathOpsTightBoundsMoveOne, reporter) {
141 SkPath path;
142 path.moveTo(20, 20);
143 const SkRect& bounds = path.getBounds();
144 SkRect tight;
145 REPORTER_ASSERT(reporter, TightBounds(path, &tight));
146 REPORTER_ASSERT(reporter, bounds == tight);
147 }
148
149 DEF_TEST(PathOpsTightBoundsMoveTwo, reporter) {
150 SkPath path;
151 path.moveTo(20, 20);
152 path.moveTo(40, 40);
153 const SkRect& bounds = path.getBounds();
154 SkRect tight;
155 REPORTER_ASSERT(reporter, TightBounds(path, &tight));
156 REPORTER_ASSERT(reporter, bounds == tight);
157 }
158
159 DEF_TEST(PathOpsTightBoundsTiny, reporter) {
160 SkPath path;
161 path.moveTo(1, 1);
162 path.quadTo(1.000001f, 1, 1, 1);
163 const SkRect& bounds = path.getBounds();
164 SkRect tight;
165 REPORTER_ASSERT(reporter, TightBounds(path, &tight));
166 SkRect moveBounds = {1, 1, 1, 1};
167 REPORTER_ASSERT(reporter, bounds != tight);
168 REPORTER_ASSERT(reporter, moveBounds == tight);
169 }
170
171 DEF_TEST(PathOpsTightBoundsWellBehaved, reporter) {
172 SkPath path;
173 path.moveTo(1, 1);
174 path.quadTo(2, 3, 4, 5);
175 const SkRect& bounds = path.getBounds();
176 SkRect tight;
177 REPORTER_ASSERT(reporter, TightBounds(path, &tight));
178 REPORTER_ASSERT(reporter, bounds == tight);
179 }
180
181 DEF_TEST(PathOpsTightBoundsIllBehaved, reporter) {
182 SkPath path;
183 path.moveTo(1, 1);
184 path.quadTo(4, 3, 2, 2);
185 const SkRect& bounds = path.getBounds();
186 SkRect tight;
187 REPORTER_ASSERT(reporter, TightBounds(path, &tight));
188 REPORTER_ASSERT(reporter, bounds != tight);
189 }
190
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsTightBounds.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698