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 | 7 |
8 #include "SkBlurImageFilter.h" | 8 #include "SkBlurImageFilter.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 SkCanvas* canvas = recorder.beginRecording(10, 10); | 1514 SkCanvas* canvas = recorder.beginRecording(10, 10); |
1515 canvas->drawBitmap(bm, 0, 0); | 1515 canvas->drawBitmap(bm, 0, 0); |
1516 canvas->drawPicture(childWithBitmap); | 1516 canvas->drawPicture(childWithBitmap); |
1517 SkAutoTUnref<SkPicture> parentWBWB(recorder.endRecording()); | 1517 SkAutoTUnref<SkPicture> parentWBWB(recorder.endRecording()); |
1518 REPORTER_ASSERT(reporter, parentWBWB->willPlayBackBitmaps()); // 2 | 1518 REPORTER_ASSERT(reporter, parentWBWB->willPlayBackBitmaps()); // 2 |
1519 } | 1519 } |
1520 } | 1520 } |
1521 | 1521 |
1522 static void test_gen_id(skiatest::Reporter* reporter) { | 1522 static void test_gen_id(skiatest::Reporter* reporter) { |
1523 | 1523 |
1524 SkPicture empty; | 1524 SkPictureRecorder recorder; |
| 1525 recorder.beginRecording(0, 0); |
| 1526 SkAutoTUnref<SkPicture> empty(recorder.endRecording()); |
1525 | 1527 |
1526 // Empty pictures should still have a valid ID | 1528 // Empty pictures should still have a valid ID |
1527 REPORTER_ASSERT(reporter, empty.uniqueID() != SK_InvalidGenID); | 1529 REPORTER_ASSERT(reporter, empty->uniqueID() != SK_InvalidGenID); |
1528 | |
1529 SkPictureRecorder recorder; | |
1530 | 1530 |
1531 SkCanvas* canvas = recorder.beginRecording(1, 1); | 1531 SkCanvas* canvas = recorder.beginRecording(1, 1); |
1532 canvas->drawARGB(255, 255, 255, 255); | 1532 canvas->drawARGB(255, 255, 255, 255); |
1533 SkAutoTUnref<SkPicture> hasData(recorder.endRecording()); | 1533 SkAutoTUnref<SkPicture> hasData(recorder.endRecording()); |
1534 // picture should have a non-zero id after recording | 1534 // picture should have a non-zero id after recording |
1535 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID); | 1535 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID); |
1536 | 1536 |
1537 // both pictures should have different ids | 1537 // both pictures should have different ids |
1538 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty.uniqueID()); | 1538 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID()); |
1539 } | 1539 } |
1540 | 1540 |
1541 DEF_TEST(Picture, reporter) { | 1541 DEF_TEST(Picture, reporter) { |
1542 #ifdef SK_DEBUG | 1542 #ifdef SK_DEBUG |
1543 test_deleting_empty_picture(); | 1543 test_deleting_empty_picture(); |
1544 test_serializing_empty_picture(); | 1544 test_serializing_empty_picture(); |
1545 #else | 1545 #else |
1546 test_bad_bitmap(); | 1546 test_bad_bitmap(); |
1547 #endif | 1547 #endif |
1548 test_unbalanced_save_restores(reporter); | 1548 test_unbalanced_save_restores(reporter); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1592 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
1593 } | 1593 } |
1594 | 1594 |
1595 DEF_TEST(Canvas_EmptyBitmap, r) { | 1595 DEF_TEST(Canvas_EmptyBitmap, r) { |
1596 SkBitmap dst; | 1596 SkBitmap dst; |
1597 dst.allocN32Pixels(10, 10); | 1597 dst.allocN32Pixels(10, 10); |
1598 SkCanvas canvas(dst); | 1598 SkCanvas canvas(dst); |
1599 | 1599 |
1600 test_draw_bitmaps(&canvas); | 1600 test_draw_bitmaps(&canvas); |
1601 } | 1601 } |
OLD | NEW |