OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkAAClip.h" | 8 #include "SkAAClip.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkMask.h" | 10 #include "SkMask.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 clip1.setRect(r1); | 255 clip1.setRect(r1); |
256 rgn0.setRect(r0); | 256 rgn0.setRect(r0); |
257 rgn1.setRect(r1); | 257 rgn1.setRect(r1); |
258 for (size_t j = 0; j < SK_ARRAY_COUNT(gRgnOps); ++j) { | 258 for (size_t j = 0; j < SK_ARRAY_COUNT(gRgnOps); ++j) { |
259 SkRegion::Op op = gRgnOps[j]; | 259 SkRegion::Op op = gRgnOps[j]; |
260 SkAAClip clip2; | 260 SkAAClip clip2; |
261 SkRegion rgn2; | 261 SkRegion rgn2; |
262 bool nonEmptyAA = clip2.op(clip0, clip1, op); | 262 bool nonEmptyAA = clip2.op(clip0, clip1, op); |
263 bool nonEmptyBW = rgn2.op(rgn0, rgn1, op); | 263 bool nonEmptyBW = rgn2.op(rgn0, rgn1, op); |
264 if (nonEmptyAA != nonEmptyBW || clip2.getBounds() != rgn2.getBounds(
)) { | 264 if (nonEmptyAA != nonEmptyBW || clip2.getBounds() != rgn2.getBounds(
)) { |
265 SkDebugf("[%d %d %d %d] %s [%d %d %d %d] = BW:[%d %d %d %d] AA:[
%d %d %d %d]\n", | 265 ERRORF(reporter, "%s %s " |
266 r0.fLeft, r0.fTop, r0.right(), r0.bottom(), | 266 "[%d %d %d %d] %s [%d %d %d %d] = BW:[%d %d %d %d] AA:[%d
%d %d %d]\n", |
267 gRgnOpNames[j], | 267 nonEmptyAA == nonEmptyBW ? "true" : "false", |
268 r1.fLeft, r1.fTop, r1.right(), r1.bottom(), | 268 clip2.getBounds() == rgn2.getBounds() ? "true" : "false", |
269 rgn2.getBounds().fLeft, rgn2.getBounds().fTop, | 269 r0.fLeft, r0.fTop, r0.right(), r0.bottom(), |
270 rgn2.getBounds().right(), rgn2.getBounds().bottom(), | 270 gRgnOpNames[j], |
271 clip2.getBounds().fLeft, clip2.getBounds().fTop, | 271 r1.fLeft, r1.fTop, r1.right(), r1.bottom(), |
272 clip2.getBounds().right(), clip2.getBounds().bottom()); | 272 rgn2.getBounds().fLeft, rgn2.getBounds().fTop, |
| 273 rgn2.getBounds().right(), rgn2.getBounds().bottom(), |
| 274 clip2.getBounds().fLeft, clip2.getBounds().fTop, |
| 275 clip2.getBounds().right(), clip2.getBounds().bottom()); |
273 } | 276 } |
274 REPORTER_ASSERT(reporter, nonEmptyAA == nonEmptyBW); | |
275 REPORTER_ASSERT(reporter, clip2.getBounds() == rgn2.getBounds()); | |
276 | 277 |
277 SkMask maskBW, maskAA; | 278 SkMask maskBW, maskAA; |
278 copyToMask(rgn2, &maskBW); | 279 copyToMask(rgn2, &maskBW); |
279 clip2.copyToMask(&maskAA); | 280 clip2.copyToMask(&maskAA); |
280 SkAutoMaskFreeImage freeBW(maskBW.fImage); | 281 SkAutoMaskFreeImage freeBW(maskBW.fImage); |
281 SkAutoMaskFreeImage freeAA(maskAA.fImage); | 282 SkAutoMaskFreeImage freeAA(maskAA.fImage); |
282 REPORTER_ASSERT(reporter, maskBW == maskAA); | 283 REPORTER_ASSERT(reporter, maskBW == maskAA); |
283 } | 284 } |
284 } | 285 } |
285 } | 286 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 test_empty(reporter); | 439 test_empty(reporter); |
439 test_path_bounds(reporter); | 440 test_path_bounds(reporter); |
440 test_irect(reporter); | 441 test_irect(reporter); |
441 test_rgn(reporter); | 442 test_rgn(reporter); |
442 test_path_with_hole(reporter); | 443 test_path_with_hole(reporter); |
443 test_regressions(); | 444 test_regressions(); |
444 test_nearly_integral(reporter); | 445 test_nearly_integral(reporter); |
445 test_really_a_rect(reporter); | 446 test_really_a_rect(reporter); |
446 test_crbug_422693(reporter); | 447 test_crbug_422693(reporter); |
447 } | 448 } |
OLD | NEW |