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

Side by Side Diff: tests/GrShapeTest.cpp

Issue 2046753002: Get segment masks from GrShape. (Closed) Base URL: https://chromium.googlesource.com/skia.git@shapedirandstart
Patch Set: Created 4 years, 6 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/gpu/GrShape.h ('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 2016 Google Inc. 2 * Copyright 2016 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 7
8 #include <initializer_list> 8 #include <initializer_list>
9 #include <functional> 9 #include <functional>
10 #include "Test.h" 10 #include "Test.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if (fAppliedPE.asRRect(nullptr, nullptr, nullptr)) { 150 if (fAppliedPE.asRRect(nullptr, nullptr, nullptr)) {
151 REPORTER_ASSERT(r, paths_fill_same(a, b)); 151 REPORTER_ASSERT(r, paths_fill_same(a, b));
152 } else { 152 } else {
153 REPORTER_ASSERT(r, a == b); 153 REPORTER_ASSERT(r, a == b);
154 } 154 }
155 REPORTER_ASSERT(r, fAppliedFull.isEmpty() == fAppliedPEThenStroke.isEmpt y()); 155 REPORTER_ASSERT(r, fAppliedFull.isEmpty() == fAppliedPEThenStroke.isEmpt y());
156 156
157 SkPath path; 157 SkPath path;
158 fBase.asPath(&path); 158 fBase.asPath(&path);
159 REPORTER_ASSERT(r, path.isEmpty() == fBase.isEmpty()); 159 REPORTER_ASSERT(r, path.isEmpty() == fBase.isEmpty());
160 REPORTER_ASSERT(r, path.getSegmentMasks() == fBase.segmentMask());
160 fAppliedPE.asPath(&path); 161 fAppliedPE.asPath(&path);
161 REPORTER_ASSERT(r, path.isEmpty() == fAppliedPE.isEmpty()); 162 REPORTER_ASSERT(r, path.isEmpty() == fAppliedPE.isEmpty());
163 REPORTER_ASSERT(r, path.getSegmentMasks() == fAppliedPE.segmentMask());
162 fAppliedFull.asPath(&path); 164 fAppliedFull.asPath(&path);
163 REPORTER_ASSERT(r, path.isEmpty() == fAppliedFull.isEmpty()); 165 REPORTER_ASSERT(r, path.isEmpty() == fAppliedFull.isEmpty());
166 REPORTER_ASSERT(r, path.getSegmentMasks() == fAppliedFull.segmentMask()) ;
164 167
165 CheckBounds(r, fBase, fBase.bounds()); 168 CheckBounds(r, fBase, fBase.bounds());
166 CheckBounds(r, fAppliedPE, fAppliedPE.bounds()); 169 CheckBounds(r, fAppliedPE, fAppliedPE.bounds());
167 CheckBounds(r, fAppliedPEThenStroke, fAppliedPEThenStroke.bounds()); 170 CheckBounds(r, fAppliedPEThenStroke, fAppliedPEThenStroke.bounds());
168 CheckBounds(r, fAppliedFull, fAppliedFull.bounds()); 171 CheckBounds(r, fAppliedFull, fAppliedFull.bounds());
169 SkRect styledBounds; 172 SkRect styledBounds;
170 fBase.styledBounds(&styledBounds); 173 fBase.styledBounds(&styledBounds);
171 CheckBounds(r, fAppliedFull, styledBounds); 174 CheckBounds(r, fAppliedFull, styledBounds);
172 fAppliedPE.styledBounds(&styledBounds); 175 fAppliedPE.styledBounds(&styledBounds);
173 CheckBounds(r, fAppliedFull, styledBounds); 176 CheckBounds(r, fAppliedFull, styledBounds);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 REPORTER_ASSERT(r, aIsRRect == bIsRRect); 279 REPORTER_ASSERT(r, aIsRRect == bIsRRect);
277 if (aIsRRect) { 280 if (aIsRRect) {
278 REPORTER_ASSERT(r, rrectA == rrectB); 281 REPORTER_ASSERT(r, rrectA == rrectB);
279 REPORTER_ASSERT(r, dirA == dirB); 282 REPORTER_ASSERT(r, dirA == dirB);
280 REPORTER_ASSERT(r, startA == startB); 283 REPORTER_ASSERT(r, startA == startB);
281 } 284 }
282 } 285 }
283 REPORTER_ASSERT(r, a.isEmpty() == b.isEmpty()); 286 REPORTER_ASSERT(r, a.isEmpty() == b.isEmpty());
284 REPORTER_ASSERT(r, a.knownToBeClosed() == b.knownToBeClosed()); 287 REPORTER_ASSERT(r, a.knownToBeClosed() == b.knownToBeClosed());
285 REPORTER_ASSERT(r, a.bounds() == b.bounds()); 288 REPORTER_ASSERT(r, a.bounds() == b.bounds());
289 REPORTER_ASSERT(r, a.segmentMask() == b.segmentMask());
286 } 290 }
287 291
288 void TestCase::compare(skiatest::Reporter* r, const TestCase& that, 292 void TestCase::compare(skiatest::Reporter* r, const TestCase& that,
289 ComparisonExpecation expectation) const { 293 ComparisonExpecation expectation) const {
290 SkPath a, b; 294 SkPath a, b;
291 switch (expectation) { 295 switch (expectation) {
292 case kAllDifferent_ComparisonExpecation: 296 case kAllDifferent_ComparisonExpecation:
293 REPORTER_ASSERT(r, fBaseKey != that.fBaseKey); 297 REPORTER_ASSERT(r, fBaseKey != that.fBaseKey);
294 REPORTER_ASSERT(r, fAppliedPEKey != that.fAppliedPEKey); 298 REPORTER_ASSERT(r, fAppliedPEKey != that.fAppliedPEKey);
295 REPORTER_ASSERT(r, fAppliedFullKey != that.fAppliedFullKey); 299 REPORTER_ASSERT(r, fAppliedFullKey != that.fAppliedFullKey);
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 } 1077 }
1074 } 1078 }
1075 1079
1076 // Test a volatile empty path. 1080 // Test a volatile empty path.
1077 test_volatile_path(reporter, SkPath(), true); 1081 test_volatile_path(reporter, SkPath(), true);
1078 1082
1079 test_empty_shape(reporter); 1083 test_empty_shape(reporter);
1080 } 1084 }
1081 1085
1082 #endif 1086 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrShape.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698