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