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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 copyToMask(a, &ma); | 364 copyToMask(a, &ma); |
365 copyToMask(b, &mb); | 365 copyToMask(b, &mb); |
366 SkAutoMaskFreeImage aCleanUp(ma.fImage); | 366 SkAutoMaskFreeImage aCleanUp(ma.fImage); |
367 SkAutoMaskFreeImage bCleanUp(mb.fImage); | 367 SkAutoMaskFreeImage bCleanUp(mb.fImage); |
368 | 368 |
369 return ma == mb; | 369 return ma == mb; |
370 } | 370 } |
371 | 371 |
372 static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[], | 372 static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[], |
373 size_t count, bool changed) { | 373 size_t count, bool changed) { |
| 374 const SkISize baseSize = SkISize::Make(10, 10); |
374 SkIRect ir = { 0, 0, 10, 10 }; | 375 SkIRect ir = { 0, 0, 10, 10 }; |
375 | 376 |
376 for (size_t i = 0; i < count; ++i) { | 377 for (size_t i = 0; i < count; ++i) { |
377 SkRect r; | 378 SkRect r; |
378 r.set(ir); | 379 r.set(ir); |
379 | 380 |
380 SkRasterClip rc0(ir); | 381 SkRasterClip rc0(ir); |
381 SkRasterClip rc1(ir); | 382 SkRasterClip rc1(ir); |
382 SkRasterClip rc2(ir); | 383 SkRasterClip rc2(ir); |
383 | 384 |
384 rc0.op(r, SkRegion::kIntersect_Op, false); | 385 rc0.op(r, baseSize, SkRegion::kIntersect_Op, false); |
385 r.offset(dx[i], 0); | 386 r.offset(dx[i], 0); |
386 rc1.op(r, SkRegion::kIntersect_Op, true); | 387 rc1.op(r, baseSize, SkRegion::kIntersect_Op, true); |
387 r.offset(-2*dx[i], 0); | 388 r.offset(-2*dx[i], 0); |
388 rc2.op(r, SkRegion::kIntersect_Op, true); | 389 rc2.op(r, baseSize, SkRegion::kIntersect_Op, true); |
389 | 390 |
390 REPORTER_ASSERT(reporter, changed != (rc0 == rc1)); | 391 REPORTER_ASSERT(reporter, changed != (rc0 == rc1)); |
391 REPORTER_ASSERT(reporter, changed != (rc0 == rc2)); | 392 REPORTER_ASSERT(reporter, changed != (rc0 == rc2)); |
392 } | 393 } |
393 } | 394 } |
394 | 395 |
395 static void test_nearly_integral(skiatest::Reporter* reporter) { | 396 static void test_nearly_integral(skiatest::Reporter* reporter) { |
396 // All of these should generate equivalent rasterclips | 397 // All of these should generate equivalent rasterclips |
397 | 398 |
398 static const SkScalar gSafeX[] = { | 399 static const SkScalar gSafeX[] = { |
(...skipping 24 matching lines...) Expand all Loading... |
423 DEF_TEST(AAClip, reporter) { | 424 DEF_TEST(AAClip, reporter) { |
424 test_empty(reporter); | 425 test_empty(reporter); |
425 test_path_bounds(reporter); | 426 test_path_bounds(reporter); |
426 test_irect(reporter); | 427 test_irect(reporter); |
427 test_rgn(reporter); | 428 test_rgn(reporter); |
428 test_path_with_hole(reporter); | 429 test_path_with_hole(reporter); |
429 test_regressions(); | 430 test_regressions(); |
430 test_nearly_integral(reporter); | 431 test_nearly_integral(reporter); |
431 test_really_a_rect(reporter); | 432 test_really_a_rect(reporter); |
432 } | 433 } |
OLD | NEW |