| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 // Everything in the analytic list should appear in the gathered | 655 // Everything in the analytic list should appear in the gathered |
| 656 // list. | 656 // list. |
| 657 for (int i = 0; i < fromAnalytic.count(); ++i) { | 657 for (int i = 0; i < fromAnalytic.count(); ++i) { |
| 658 REPORTER_ASSERT(reporter, -1 != gatheredRefs.find(fromAnalytic[i
])); | 658 REPORTER_ASSERT(reporter, -1 != gatheredRefs.find(fromAnalytic[i
])); |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 } | 661 } |
| 662 } | 662 } |
| 663 | 663 |
| 664 #ifdef SK_DEBUG | 664 #ifdef SK_DEBUG |
| 665 // Ensure that deleting SkPicturePlayback does not assert. Asserts only fire in
debug mode, so only | 665 // Ensure that deleting an empty SkPicture does not assert. Asserts only fire |
| 666 // run in debug mode. | 666 // in debug mode, so only run in debug mode. |
| 667 static void test_deleting_empty_playback() { | 667 static void test_deleting_empty_picture() { |
| 668 SkPictureRecorder recorder; | 668 SkPictureRecorder recorder; |
| 669 // Creates an SkPictureRecord | 669 // Creates an SkPictureRecord |
| 670 recorder.beginRecording(0, 0); | 670 recorder.beginRecording(0, 0); |
| 671 // Turns that into an SkPicturePlayback | 671 // Turns that into an SkPicture |
| 672 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 672 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 673 // Deletes the old SkPicturePlayback, and creates a new SkPictureRecord | 673 // Ceates a new SkPictureRecord |
| 674 recorder.beginRecording(0, 0); | 674 recorder.beginRecording(0, 0); |
| 675 } | 675 } |
| 676 | 676 |
| 677 // Ensure that serializing an empty picture does not assert. Likewise only runs
in debug mode. | 677 // Ensure that serializing an empty picture does not assert. Likewise only runs
in debug mode. |
| 678 static void test_serializing_empty_picture() { | 678 static void test_serializing_empty_picture() { |
| 679 SkPictureRecorder recorder; | 679 SkPictureRecorder recorder; |
| 680 recorder.beginRecording(0, 0); | 680 recorder.beginRecording(0, 0); |
| 681 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 681 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 682 SkDynamicMemoryWStream stream; | 682 SkDynamicMemoryWStream stream; |
| 683 picture->serialize(&stream); | 683 picture->serialize(&stream); |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 // test out copy constructor | 1540 // test out copy constructor |
| 1541 SkPicture copyWithData(*hasData); | 1541 SkPicture copyWithData(*hasData); |
| 1542 REPORTER_ASSERT(reporter, hasData->uniqueID() == copyWithData.uniqueID()); | 1542 REPORTER_ASSERT(reporter, hasData->uniqueID() == copyWithData.uniqueID()); |
| 1543 | 1543 |
| 1544 SkPicture emptyCopy(empty); | 1544 SkPicture emptyCopy(empty); |
| 1545 REPORTER_ASSERT(reporter, empty.uniqueID() != emptyCopy.uniqueID()); | 1545 REPORTER_ASSERT(reporter, empty.uniqueID() != emptyCopy.uniqueID()); |
| 1546 } | 1546 } |
| 1547 | 1547 |
| 1548 DEF_TEST(Picture, reporter) { | 1548 DEF_TEST(Picture, reporter) { |
| 1549 #ifdef SK_DEBUG | 1549 #ifdef SK_DEBUG |
| 1550 test_deleting_empty_playback(); | 1550 test_deleting_empty_picture(); |
| 1551 test_serializing_empty_picture(); | 1551 test_serializing_empty_picture(); |
| 1552 #else | 1552 #else |
| 1553 test_bad_bitmap(); | 1553 test_bad_bitmap(); |
| 1554 #endif | 1554 #endif |
| 1555 test_unbalanced_save_restores(reporter); | 1555 test_unbalanced_save_restores(reporter); |
| 1556 test_peephole(); | 1556 test_peephole(); |
| 1557 #if SK_SUPPORT_GPU | 1557 #if SK_SUPPORT_GPU |
| 1558 test_gpu_veto(reporter); | 1558 test_gpu_veto(reporter); |
| 1559 #endif | 1559 #endif |
| 1560 test_gatherpixelrefs(reporter); | 1560 test_gatherpixelrefs(reporter); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1599 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 DEF_TEST(Canvas_EmptyBitmap, r) { | 1602 DEF_TEST(Canvas_EmptyBitmap, r) { |
| 1603 SkBitmap dst; | 1603 SkBitmap dst; |
| 1604 dst.allocN32Pixels(10, 10); | 1604 dst.allocN32Pixels(10, 10); |
| 1605 SkCanvas canvas(dst); | 1605 SkCanvas canvas(dst); |
| 1606 | 1606 |
| 1607 test_draw_bitmaps(&canvas); | 1607 test_draw_bitmaps(&canvas); |
| 1608 } | 1608 } |
| OLD | NEW |