OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "Test.h" | 7 #include "Test.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 { | 442 { |
443 // Test without call to endRecording | 443 // Test without call to endRecording |
444 SkPicture picture; | 444 SkPicture picture; |
445 picture.beginRecording(1, 1); | 445 picture.beginRecording(1, 1); |
446 SkPicture* destPicture = picture.clone(); | 446 SkPicture* destPicture = picture.clone(); |
447 REPORTER_ASSERT(reporter, NULL != destPicture); | 447 REPORTER_ASSERT(reporter, NULL != destPicture); |
448 destPicture->unref(); | 448 destPicture->unref(); |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
| 452 static void test_inverse_fill_clip_opt(skiatest::Reporter* reporter) { |
| 453 // Regression test for crbug.com/229011 |
| 454 SkPicture picture; |
| 455 SkCanvas* canvas = picture.beginRecording(10, 10, |
| 456 SkPicture::kUsePathBoundsForClip_RecordingFlag); |
| 457 SkRect rect = SkRect::MakeXYWH(SkIntToScalar(4), SkIntToScalar(4), |
| 458 SkIntToScalar(2), SkIntToScalar(2)); |
| 459 SkPath path; |
| 460 path.addRect(rect); |
| 461 path.setFillType(SkPath::kInverseEvenOdd_FillType); |
| 462 canvas->clipPath(path); |
| 463 SkIRect clipBounds; |
| 464 bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); |
| 465 REPORTER_ASSERT(reporter, true == nonEmpty); |
| 466 REPORTER_ASSERT(reporter, 0 == clipBounds.fLeft); |
| 467 REPORTER_ASSERT(reporter, 0 == clipBounds.fTop); |
| 468 REPORTER_ASSERT(reporter, 10 == clipBounds.fBottom); |
| 469 REPORTER_ASSERT(reporter, 10 == clipBounds.fRight); |
| 470 } |
| 471 |
452 static void TestPicture(skiatest::Reporter* reporter) { | 472 static void TestPicture(skiatest::Reporter* reporter) { |
453 #ifdef SK_DEBUG | 473 #ifdef SK_DEBUG |
454 test_deleting_empty_playback(); | 474 test_deleting_empty_playback(); |
455 test_serializing_empty_picture(); | 475 test_serializing_empty_picture(); |
456 #else | 476 #else |
457 test_bad_bitmap(); | 477 test_bad_bitmap(); |
458 #endif | 478 #endif |
459 test_peephole(); | 479 test_peephole(); |
460 test_gatherpixelrefs(reporter); | 480 test_gatherpixelrefs(reporter); |
461 test_bitmap_with_encoded_data(reporter); | 481 test_bitmap_with_encoded_data(reporter); |
462 test_clone_empty(reporter); | 482 test_clone_empty(reporter); |
| 483 test_inverse_fill_clip_opt(reporter); |
463 } | 484 } |
464 | 485 |
465 #include "TestClassDef.h" | 486 #include "TestClassDef.h" |
466 DEFINE_TESTCLASS("Pictures", PictureTestClass, TestPicture) | 487 DEFINE_TESTCLASS("Pictures", PictureTestClass, TestPicture) |
OLD | NEW |