Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 2103133002: Enable many more tests for Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@unitTests3
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/ImageFilterCacheTest.cpp ('k') | tests/ImageIsOpaqueTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 REPORTER_ASSERT(reporter, resultImg); 908 REPORTER_ASSERT(reporter, resultImg);
909 909
910 REPORTER_ASSERT(reporter, resultImg->width() == 20 && resultImg->height() == 20); 910 REPORTER_ASSERT(reporter, resultImg->width() == 20 && resultImg->height() == 20);
911 } 911 }
912 912
913 DEF_TEST(ImageFilterMergeResultSize, reporter) { 913 DEF_TEST(ImageFilterMergeResultSize, reporter) {
914 test_imagefilter_merge_result_size(reporter, nullptr); 914 test_imagefilter_merge_result_size(reporter, nullptr);
915 } 915 }
916 916
917 #if SK_SUPPORT_GPU 917 #if SK_SUPPORT_GPU
918 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) { 918 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctx Info) {
919 test_imagefilter_merge_result_size(reporter, ctxInfo.grContext()); 919 test_imagefilter_merge_result_size(reporter, ctxInfo.grContext());
920 } 920 }
921 #endif 921 #endif
922 922
923 static void draw_blurred_rect(SkCanvas* canvas) { 923 static void draw_blurred_rect(SkCanvas* canvas) {
924 SkPaint filterPaint; 924 SkPaint filterPaint;
925 filterPaint.setColor(SK_ColorWHITE); 925 filterPaint.setColor(SK_ColorWHITE);
926 filterPaint.setImageFilter(SkBlurImageFilter::Make(SkIntToScalar(8), 0, null ptr)); 926 filterPaint.setImageFilter(SkBlurImageFilter::Make(SkIntToScalar(8), 0, null ptr));
927 canvas->saveLayer(nullptr, &filterPaint); 927 canvas->saveLayer(nullptr, &filterPaint);
928 SkPaint whitePaint; 928 SkPaint whitePaint;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 REPORTER_ASSERT(reporter, SkToBool(context) == resultImg->isTextureBacked()) ; 1076 REPORTER_ASSERT(reporter, SkToBool(context) == resultImg->isTextureBacked()) ;
1077 REPORTER_ASSERT(reporter, resultImg->width() == 100 && resultImg->height() = = 100); 1077 REPORTER_ASSERT(reporter, resultImg->width() == 100 && resultImg->height() = = 100);
1078 REPORTER_ASSERT(reporter, offset.fX == 0 && offset.fY == 0); 1078 REPORTER_ASSERT(reporter, offset.fX == 0 && offset.fY == 0);
1079 } 1079 }
1080 1080
1081 DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) { 1081 DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) {
1082 test_big_kernel(reporter, nullptr); 1082 test_big_kernel(reporter, nullptr);
1083 } 1083 }
1084 1084
1085 #if SK_SUPPORT_GPU 1085 #if SK_SUPPORT_GPU
1086 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu, 1086 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
1087 reporter, ctxInfo) { 1087 reporter, ctxInfo) {
1088 test_big_kernel(reporter, ctxInfo.grContext()); 1088 test_big_kernel(reporter, ctxInfo.grContext());
1089 } 1089 }
1090 #endif 1090 #endif
1091 1091
1092 DEF_TEST(ImageFilterCropRect, reporter) { 1092 DEF_TEST(ImageFilterCropRect, reporter) {
1093 test_crop_rects(reporter, nullptr); 1093 test_crop_rects(reporter, nullptr);
1094 } 1094 }
1095 1095
1096 #if SK_SUPPORT_GPU 1096 #if SK_SUPPORT_GPU
1097 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) { 1097 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 REPORTER_ASSERT(reporter, result->getROPixels(&resultBM)); 1507 REPORTER_ASSERT(reporter, result->getROPixels(&resultBM));
1508 SkAutoLockPixels lock(resultBM); 1508 SkAutoLockPixels lock(resultBM);
1509 REPORTER_ASSERT(reporter, resultBM.getColor(50, 50) == SK_ColorGREEN); 1509 REPORTER_ASSERT(reporter, resultBM.getColor(50, 50) == SK_ColorGREEN);
1510 } 1510 }
1511 1511
1512 DEF_TEST(ComposedImageFilterBounds, reporter) { 1512 DEF_TEST(ComposedImageFilterBounds, reporter) {
1513 test_composed_imagefilter_bounds(reporter, nullptr); 1513 test_composed_imagefilter_bounds(reporter, nullptr);
1514 } 1514 }
1515 1515
1516 #if SK_SUPPORT_GPU 1516 #if SK_SUPPORT_GPU
1517 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, c txInfo) { 1517 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxI nfo) {
1518 test_composed_imagefilter_bounds(reporter, ctxInfo.grContext()); 1518 test_composed_imagefilter_bounds(reporter, ctxInfo.grContext());
1519 } 1519 }
1520 #endif 1520 #endif
1521 1521
1522 static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* cont ext) { 1522 static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* cont ext) {
1523 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100)); 1523 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
1524 1524
1525 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30), 1525 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30),
1526 SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::k HasHeight_CropEdge); 1526 SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::k HasHeight_CropEdge);
1527 sk_sp<SkImageFilter> filter(make_grayscale(nullptr, &cropRect)); 1527 sk_sp<SkImageFilter> filter(make_grayscale(nullptr, &cropRect));
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(), 1746 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
1747 SkBudgeted::kNo, 1747 SkBudgeted::kNo,
1748 SkImageInfo::MakeN32Premul (100, 100))); 1748 SkImageInfo::MakeN32Premul (100, 100)));
1749 1749
1750 1750
1751 SkCanvas* canvas = surf->getCanvas(); 1751 SkCanvas* canvas = surf->getCanvas();
1752 1752
1753 test_huge_blur(canvas, reporter); 1753 test_huge_blur(canvas, reporter);
1754 } 1754 }
1755 1755
1756 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, repor ter, ctxInfo) { 1756 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter , ctxInfo) {
1757 1757
1758 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(), 1758 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
1759 SkBudgeted::kNo, 1759 SkBudgeted::kNo,
1760 SkImageInfo::MakeN32Premul (1, 1))); 1760 SkImageInfo::MakeN32Premul (1, 1)));
1761 1761
1762 1762
1763 SkCanvas* canvas = surf->getCanvas(); 1763 SkCanvas* canvas = surf->getCanvas();
1764 1764
1765 test_xfermode_cropped_input(canvas, reporter); 1765 test_xfermode_cropped_input(canvas, reporter);
1766 } 1766 }
1767 1767
1768 DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo ) { 1768 DEF_GPUTEST_FOR_ALL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) {
1769 auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kY es, 1769 auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kY es,
1770 SkImageInfo::MakeN32Premul(100, 100 ))); 1770 SkImageInfo::MakeN32Premul(100, 100 )));
1771 test_large_blur_input(reporter, surface->getCanvas()); 1771 test_large_blur_input(reporter, surface->getCanvas());
1772 } 1772 }
1773 #endif 1773 #endif
1774 1774
1775 /* 1775 /*
1776 * Test that colorfilterimagefilter does not require its CTM to be decomposed w hen it has more 1776 * Test that colorfilterimagefilter does not require its CTM to be decomposed w hen it has more
1777 * than just scale/translate, but that other filters do. 1777 * than just scale/translate, but that other filters do.
1778 */ 1778 */
(...skipping 17 matching lines...) Expand all
1796 { SkColorFilterImageFilter::Make(cf, blif), false }, 1796 { SkColorFilterImageFilter::Make(cf, blif), false },
1797 { SkMergeImageFilter::Make(cfif, blif), false }, 1797 { SkMergeImageFilter::Make(cfif, blif), false },
1798 { SkComposeImageFilter::Make(blif, cfif), false }, 1798 { SkComposeImageFilter::Make(blif, cfif), false },
1799 }; 1799 };
1800 1800
1801 for (const auto& rec : recs) { 1801 for (const auto& rec : recs) {
1802 const bool canHandle = rec.fFilter->canHandleComplexCTM(); 1802 const bool canHandle = rec.fFilter->canHandleComplexCTM();
1803 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle); 1803 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle);
1804 } 1804 }
1805 } 1805 }
OLDNEW
« no previous file with comments | « tests/ImageFilterCacheTest.cpp ('k') | tests/ImageIsOpaqueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698