| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 <functional> | 8 #include <functional> |
| 9 #include <initializer_list> | 9 #include <initializer_list> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 RasterDataHolder dataHolder; | 590 RasterDataHolder dataHolder; |
| 591 image = create_rasterproc_image(&dataHolder); | 591 image = create_rasterproc_image(&dataHolder); |
| 592 test_read_pixels(reporter, image.get()); | 592 test_read_pixels(reporter, image.get()); |
| 593 image.reset(); | 593 image.reset(); |
| 594 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); | 594 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); |
| 595 | 595 |
| 596 image = create_codec_image(); | 596 image = create_codec_image(); |
| 597 test_read_pixels(reporter, image.get()); | 597 test_read_pixels(reporter, image.get()); |
| 598 } | 598 } |
| 599 #if SK_SUPPORT_GPU | 599 #if SK_SUPPORT_GPU |
| 600 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) { | 600 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) { |
| 601 test_read_pixels(reporter, create_gpu_image(ctxInfo.grContext()).get()); | 601 test_read_pixels(reporter, create_gpu_image(ctxInfo.grContext()).get()); |
| 602 } | 602 } |
| 603 #endif | 603 #endif |
| 604 | 604 |
| 605 static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* ima
ge, | 605 static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* ima
ge, |
| 606 const SkBitmap& bitmap, SkImage::LegacyBitmapMod
e mode) { | 606 const SkBitmap& bitmap, SkImage::LegacyBitmapMod
e mode) { |
| 607 REPORTER_ASSERT(reporter, image->width() == bitmap.width()); | 607 REPORTER_ASSERT(reporter, image->width() == bitmap.width()); |
| 608 REPORTER_ASSERT(reporter, image->height() == bitmap.height()); | 608 REPORTER_ASSERT(reporter, image->height() == bitmap.height()); |
| 609 REPORTER_ASSERT(reporter, image->isOpaque() == bitmap.isOpaque()); | 609 REPORTER_ASSERT(reporter, image->isOpaque() == bitmap.isOpaque()); |
| 610 | 610 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 RasterDataHolder dataHolder; | 697 RasterDataHolder dataHolder; |
| 698 image = create_rasterproc_image(&dataHolder); | 698 image = create_rasterproc_image(&dataHolder); |
| 699 test_peek(reporter, image.get(), true); | 699 test_peek(reporter, image.get(), true); |
| 700 image.reset(); | 700 image.reset(); |
| 701 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); | 701 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); |
| 702 | 702 |
| 703 image = create_codec_image(); | 703 image = create_codec_image(); |
| 704 test_peek(reporter, image.get(), false); | 704 test_peek(reporter, image.get(), false); |
| 705 } | 705 } |
| 706 #if SK_SUPPORT_GPU | 706 #if SK_SUPPORT_GPU |
| 707 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) { | 707 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) { |
| 708 sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext())); | 708 sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext())); |
| 709 test_peek(reporter, image.get(), false); | 709 test_peek(reporter, image.get(), false); |
| 710 } | 710 } |
| 711 #endif | 711 #endif |
| 712 | 712 |
| 713 #if SK_SUPPORT_GPU | 713 #if SK_SUPPORT_GPU |
| 714 struct TextureReleaseChecker { | 714 struct TextureReleaseChecker { |
| 715 TextureReleaseChecker() : fReleaseCount(0) {} | 715 TextureReleaseChecker() : fReleaseCount(0) {} |
| 716 int fReleaseCount; | 716 int fReleaseCount; |
| 717 static void Release(void* self) { | 717 static void Release(void* self) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 uint32_t pixelB = *bpm.addr32(x, y); | 812 uint32_t pixelB = *bpm.addr32(x, y); |
| 813 if (pixelA != pixelB) { | 813 if (pixelA != pixelB) { |
| 814 ERRORF(reporter, "Expected image pixels to be the same. At %d,%d
0x%08x != 0x%08x", | 814 ERRORF(reporter, "Expected image pixels to be the same. At %d,%d
0x%08x != 0x%08x", |
| 815 x, y, pixelA, pixelB); | 815 x, y, pixelA, pixelB); |
| 816 return; | 816 return; |
| 817 } | 817 } |
| 818 } | 818 } |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) { | 822 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) { |
| 823 for (auto create : {&create_image, | 823 for (auto create : {&create_image, |
| 824 &create_image_565, | 824 &create_image_565, |
| 825 &create_image_ct}) { | 825 &create_image_ct}) { |
| 826 sk_sp<SkImage> image((*create)()); | 826 sk_sp<SkImage> image((*create)()); |
| 827 if (!image) { | 827 if (!image) { |
| 828 ERRORF(reporter, "Could not create image"); | 828 ERRORF(reporter, "Could not create image"); |
| 829 return; | 829 return; |
| 830 } | 830 } |
| 831 | 831 |
| 832 SkPixmap pixmap; | 832 SkPixmap pixmap; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 otherContextInfo.grContext(), buffer, budgeted)); | 936 otherContextInfo.grContext(), buffer, budgeted)); |
| 937 REPORTER_ASSERT(reporter, !newImage2); | 937 REPORTER_ASSERT(reporter, !newImage2); |
| 938 testContext->makeCurrent(); | 938 testContext->makeCurrent(); |
| 939 } | 939 } |
| 940 } | 940 } |
| 941 sk_free(buffer); | 941 sk_free(buffer); |
| 942 } | 942 } |
| 943 } | 943 } |
| 944 } | 944 } |
| 945 #endif | 945 #endif |
| OLD | NEW |