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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1966013002: Turn ContextInfos returned by GrContextFactory into structs. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 7 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 } 608 }
609 } 609 }
610 610
611 DEF_TEST(ImageFilterNegativeBlurSigma, reporter) { 611 DEF_TEST(ImageFilterNegativeBlurSigma, reporter) {
612 test_negative_blur_sigma(reporter, nullptr); 612 test_negative_blur_sigma(reporter, nullptr);
613 } 613 }
614 614
615 #if SK_SUPPORT_GPU 615 #if SK_SUPPORT_GPU
616 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, c txInfo) { 616 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, c txInfo) {
617 test_negative_blur_sigma(reporter, ctxInfo.fGrContext); 617 test_negative_blur_sigma(reporter, ctxInfo.grContext());
618 } 618 }
619 #endif 619 #endif
620 620
621 static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrContext* contex t) { 621 static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrContext* contex t) {
622 // Check that SkBlurImageFilter with a zero sigma and a non-zero srcOffset w orks correctly. 622 // Check that SkBlurImageFilter with a zero sigma and a non-zero srcOffset w orks correctly.
623 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(5, 0, 5, 10) )); 623 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(5, 0, 5, 10) ));
624 sk_sp<SkImageFilter> input(SkOffsetImageFilter::Make(0, 0, nullptr, &cropRec t)); 624 sk_sp<SkImageFilter> input(SkOffsetImageFilter::Make(0, 0, nullptr, &cropRec t));
625 sk_sp<SkImageFilter> filter(SkBlurImageFilter::Make(0, 0, std::move(input), &cropRect)); 625 sk_sp<SkImageFilter> filter(SkBlurImageFilter::Make(0, 0, std::move(input), &cropRect));
626 626
627 sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, 10)); 627 sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, 10));
(...skipping 23 matching lines...) Expand all
651 } 651 }
652 } 652 }
653 } 653 }
654 654
655 DEF_TEST(ImageFilterZeroBlurSigma, reporter) { 655 DEF_TEST(ImageFilterZeroBlurSigma, reporter) {
656 test_zero_blur_sigma(reporter, nullptr); 656 test_zero_blur_sigma(reporter, nullptr);
657 } 657 }
658 658
659 #if SK_SUPPORT_GPU 659 #if SK_SUPPORT_GPU
660 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxIn fo) { 660 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxIn fo) {
661 test_zero_blur_sigma(reporter, ctxInfo.fGrContext); 661 test_zero_blur_sigma(reporter, ctxInfo.grContext());
662 } 662 }
663 #endif 663 #endif
664 664
665 665
666 // Tests that, even when an upstream filter has returned null (due to failure or clipping), a 666 // Tests that, even when an upstream filter has returned null (due to failure or clipping), a
667 // downstream filter that affects transparent black still does so even with a nu llptr input. 667 // downstream filter that affects transparent black still does so even with a nu llptr input.
668 static void test_fail_affects_transparent_black(skiatest::Reporter* reporter, Gr Context* context) { 668 static void test_fail_affects_transparent_black(skiatest::Reporter* reporter, Gr Context* context) {
669 sk_sp<FailImageFilter> failFilter(new FailImageFilter()); 669 sk_sp<FailImageFilter> failFilter(new FailImageFilter());
670 sk_sp<SkSpecialImage> source(create_empty_special_image(context, 5)); 670 sk_sp<SkSpecialImage> source(create_empty_special_image(context, 5));
671 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 1, 1), nul lptr); 671 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 1, 1), nul lptr);
(...skipping 11 matching lines...) Expand all
683 REPORTER_ASSERT(reporter, *resultBM.getAddr32(0, 0) == SK_ColorGREEN); 683 REPORTER_ASSERT(reporter, *resultBM.getAddr32(0, 0) == SK_ColorGREEN);
684 } 684 }
685 } 685 }
686 686
687 DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) { 687 DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) {
688 test_fail_affects_transparent_black(reporter, nullptr); 688 test_fail_affects_transparent_black(reporter, nullptr);
689 } 689 }
690 690
691 #if SK_SUPPORT_GPU 691 #if SK_SUPPORT_GPU
692 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, r eporter, ctxInfo) { 692 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, r eporter, ctxInfo) {
693 test_fail_affects_transparent_black(reporter, ctxInfo.fGrContext); 693 test_fail_affects_transparent_black(reporter, ctxInfo.grContext());
694 } 694 }
695 #endif 695 #endif
696 696
697 DEF_TEST(ImageFilterDrawTiled, reporter) { 697 DEF_TEST(ImageFilterDrawTiled, reporter) {
698 // Check that all filters when drawn tiled (with subsequent clip rects) exac tly 698 // Check that all filters when drawn tiled (with subsequent clip rects) exac tly
699 // match the same filters drawn with a single full-canvas bitmap draw. 699 // match the same filters drawn with a single full-canvas bitmap draw.
700 // Tests pass by not asserting. 700 // Tests pass by not asserting.
701 701
702 FilterList filters(nullptr); 702 FilterList filters(nullptr);
703 703
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 REPORTER_ASSERT(reporter, resultImg->width() == 20 && resultImg->height() == 20); 898 REPORTER_ASSERT(reporter, resultImg->width() == 20 && resultImg->height() == 20);
899 } 899 }
900 900
901 DEF_TEST(ImageFilterMergeResultSize, reporter) { 901 DEF_TEST(ImageFilterMergeResultSize, reporter) {
902 test_imagefilter_merge_result_size(reporter, nullptr); 902 test_imagefilter_merge_result_size(reporter, nullptr);
903 } 903 }
904 904
905 #if SK_SUPPORT_GPU 905 #if SK_SUPPORT_GPU
906 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) { 906 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) {
907 test_imagefilter_merge_result_size(reporter, ctxInfo.fGrContext); 907 test_imagefilter_merge_result_size(reporter, ctxInfo.grContext());
908 } 908 }
909 #endif 909 #endif
910 910
911 static void draw_blurred_rect(SkCanvas* canvas) { 911 static void draw_blurred_rect(SkCanvas* canvas) {
912 SkPaint filterPaint; 912 SkPaint filterPaint;
913 filterPaint.setColor(SK_ColorWHITE); 913 filterPaint.setColor(SK_ColorWHITE);
914 filterPaint.setImageFilter(SkBlurImageFilter::Make(SkIntToScalar(8), 0, null ptr)); 914 filterPaint.setImageFilter(SkBlurImageFilter::Make(SkIntToScalar(8), 0, null ptr));
915 canvas->saveLayer(nullptr, &filterPaint); 915 canvas->saveLayer(nullptr, &filterPaint);
916 SkPaint whitePaint; 916 SkPaint whitePaint;
917 whitePaint.setColor(SK_ColorWHITE); 917 whitePaint.setColor(SK_ColorWHITE);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 REPORTER_ASSERT(reporter, offset.fX == 0 && offset.fY == 0); 1066 REPORTER_ASSERT(reporter, offset.fX == 0 && offset.fY == 0);
1067 } 1067 }
1068 1068
1069 DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) { 1069 DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) {
1070 test_big_kernel(reporter, nullptr); 1070 test_big_kernel(reporter, nullptr);
1071 } 1071 }
1072 1072
1073 #if SK_SUPPORT_GPU 1073 #if SK_SUPPORT_GPU
1074 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu, 1074 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
1075 reporter, ctxInfo) { 1075 reporter, ctxInfo) {
1076 test_big_kernel(reporter, ctxInfo.fGrContext); 1076 test_big_kernel(reporter, ctxInfo.grContext());
1077 } 1077 }
1078 #endif 1078 #endif
1079 1079
1080 DEF_TEST(ImageFilterCropRect, reporter) { 1080 DEF_TEST(ImageFilterCropRect, reporter) {
1081 test_crop_rects(reporter, nullptr); 1081 test_crop_rects(reporter, nullptr);
1082 } 1082 }
1083 1083
1084 #if SK_SUPPORT_GPU 1084 #if SK_SUPPORT_GPU
1085 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) { 1085 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
1086 test_crop_rects(reporter, ctxInfo.fGrContext); 1086 test_crop_rects(reporter, ctxInfo.grContext());
1087 } 1087 }
1088 #endif 1088 #endif
1089 1089
1090 DEF_TEST(ImageFilterMatrix, reporter) { 1090 DEF_TEST(ImageFilterMatrix, reporter) {
1091 SkBitmap temp; 1091 SkBitmap temp;
1092 temp.allocN32Pixels(100, 100); 1092 temp.allocN32Pixels(100, 100);
1093 SkCanvas canvas(temp); 1093 SkCanvas canvas(temp);
1094 canvas.scale(SkIntToScalar(2), SkIntToScalar(2)); 1094 canvas.scale(SkIntToScalar(2), SkIntToScalar(2));
1095 1095
1096 SkMatrix expectedMatrix = canvas.getTotalMatrix(); 1096 SkMatrix expectedMatrix = canvas.getTotalMatrix();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 sk_sp<SkSpecialImage> resultImage(imageFilter->filterImage(srcImg.get(), ctx , &offset)); 1197 sk_sp<SkSpecialImage> resultImage(imageFilter->filterImage(srcImg.get(), ctx , &offset));
1198 REPORTER_ASSERT(reporter, !resultImage); 1198 REPORTER_ASSERT(reporter, !resultImage);
1199 } 1199 }
1200 1200
1201 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { 1201 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
1202 test_clipped_picture_imagefilter(reporter, nullptr); 1202 test_clipped_picture_imagefilter(reporter, nullptr);
1203 } 1203 }
1204 1204
1205 #if SK_SUPPORT_GPU 1205 #if SK_SUPPORT_GPU
1206 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, rep orter, ctxInfo) { 1206 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, rep orter, ctxInfo) {
1207 test_clipped_picture_imagefilter(reporter, ctxInfo.fGrContext); 1207 test_clipped_picture_imagefilter(reporter, ctxInfo.grContext());
1208 } 1208 }
1209 #endif 1209 #endif
1210 1210
1211 DEF_TEST(ImageFilterEmptySaveLayer, reporter) { 1211 DEF_TEST(ImageFilterEmptySaveLayer, reporter) {
1212 // Even when there's an empty saveLayer()/restore(), ensure that an image 1212 // Even when there's an empty saveLayer()/restore(), ensure that an image
1213 // filter or color filter which affects transparent black still draws. 1213 // filter or color filter which affects transparent black still draws.
1214 1214
1215 SkBitmap bitmap; 1215 SkBitmap bitmap;
1216 bitmap.allocN32Pixels(10, 10); 1216 bitmap.allocN32Pixels(10, 10);
1217 SkCanvas canvas(bitmap); 1217 SkCanvas canvas(bitmap);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 REPORTER_ASSERT(reporter, resultImg); 1454 REPORTER_ASSERT(reporter, resultImg);
1455 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); 1455 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0);
1456 } 1456 }
1457 1457
1458 DEF_TEST(ComposedImageFilterOffset, reporter) { 1458 DEF_TEST(ComposedImageFilterOffset, reporter) {
1459 test_composed_imagefilter_offset(reporter, nullptr); 1459 test_composed_imagefilter_offset(reporter, nullptr);
1460 } 1460 }
1461 1461
1462 #if SK_SUPPORT_GPU 1462 #if SK_SUPPORT_GPU
1463 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxI nfo) { 1463 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxI nfo) {
1464 test_composed_imagefilter_offset(reporter, ctxInfo.fGrContext); 1464 test_composed_imagefilter_offset(reporter, ctxInfo.grContext());
1465 } 1465 }
1466 #endif 1466 #endif
1467 1467
1468 static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter, GrCon text* context) { 1468 static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter, GrCon text* context) {
1469 // The bounds passed to the inner filter must be filtered by the outer 1469 // The bounds passed to the inner filter must be filtered by the outer
1470 // filter, so that the inner filter produces the pixels that the outer 1470 // filter, so that the inner filter produces the pixels that the outer
1471 // filter requires as input. This matters if the outer filter moves pixels. 1471 // filter requires as input. This matters if the outer filter moves pixels.
1472 // Here, accounting for the outer offset is necessary so that the green 1472 // Here, accounting for the outer offset is necessary so that the green
1473 // pixels of the picture are not clipped. 1473 // pixels of the picture are not clipped.
1474 1474
(...skipping 21 matching lines...) Expand all
1496 SkAutoLockPixels lock(resultBM); 1496 SkAutoLockPixels lock(resultBM);
1497 REPORTER_ASSERT(reporter, resultBM.getColor(50, 50) == SK_ColorGREEN); 1497 REPORTER_ASSERT(reporter, resultBM.getColor(50, 50) == SK_ColorGREEN);
1498 } 1498 }
1499 1499
1500 DEF_TEST(ComposedImageFilterBounds, reporter) { 1500 DEF_TEST(ComposedImageFilterBounds, reporter) {
1501 test_composed_imagefilter_bounds(reporter, nullptr); 1501 test_composed_imagefilter_bounds(reporter, nullptr);
1502 } 1502 }
1503 1503
1504 #if SK_SUPPORT_GPU 1504 #if SK_SUPPORT_GPU
1505 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, c txInfo) { 1505 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, c txInfo) {
1506 test_composed_imagefilter_bounds(reporter, ctxInfo.fGrContext); 1506 test_composed_imagefilter_bounds(reporter, ctxInfo.grContext());
1507 } 1507 }
1508 #endif 1508 #endif
1509 1509
1510 static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* cont ext) { 1510 static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* cont ext) {
1511 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100)); 1511 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
1512 1512
1513 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30), 1513 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30),
1514 SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::k HasHeight_CropEdge); 1514 SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::k HasHeight_CropEdge);
1515 sk_sp<SkImageFilter> filter(make_grayscale(nullptr, &cropRect)); 1515 sk_sp<SkImageFilter> filter(make_grayscale(nullptr, &cropRect));
1516 SkIPoint offset; 1516 SkIPoint offset;
1517 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr ); 1517 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr );
1518 1518
1519 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offs et)); 1519 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offs et));
1520 REPORTER_ASSERT(reporter, resultImg); 1520 REPORTER_ASSERT(reporter, resultImg);
1521 1521
1522 REPORTER_ASSERT(reporter, offset.fX == 0); 1522 REPORTER_ASSERT(reporter, offset.fX == 0);
1523 REPORTER_ASSERT(reporter, offset.fY == 0); 1523 REPORTER_ASSERT(reporter, offset.fY == 0);
1524 REPORTER_ASSERT(reporter, resultImg->width() == 20); 1524 REPORTER_ASSERT(reporter, resultImg->width() == 20);
1525 REPORTER_ASSERT(reporter, resultImg->height() == 30); 1525 REPORTER_ASSERT(reporter, resultImg->height() == 30);
1526 } 1526 }
1527 1527
1528 DEF_TEST(ImageFilterPartialCropRect, reporter) { 1528 DEF_TEST(ImageFilterPartialCropRect, reporter) {
1529 test_partial_crop_rect(reporter, nullptr); 1529 test_partial_crop_rect(reporter, nullptr);
1530 } 1530 }
1531 1531
1532 #if SK_SUPPORT_GPU 1532 #if SK_SUPPORT_GPU
1533 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctx Info) { 1533 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctx Info) {
1534 test_partial_crop_rect(reporter, ctxInfo.fGrContext); 1534 test_partial_crop_rect(reporter, ctxInfo.grContext());
1535 } 1535 }
1536 #endif 1536 #endif
1537 1537
1538 DEF_TEST(ImageFilterCanComputeFastBounds, reporter) { 1538 DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
1539 1539
1540 { 1540 {
1541 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1); 1541 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1);
1542 sk_sp<SkImageFilter> lighting(SkLightingImageFilter::MakePointLitDiffuse (location, 1542 sk_sp<SkImageFilter> lighting(SkLightingImageFilter::MakePointLitDiffuse (location,
1543 SK_ColorGREEN, 1543 SK_ColorGREEN,
1544 0, 0, nullptr)); 1544 0, 0, nullptr));
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 1666
1667 DEF_TEST(ImageFilterBlurLargeImage, reporter) { 1667 DEF_TEST(ImageFilterBlurLargeImage, reporter) {
1668 auto surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(100, 100))); 1668 auto surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(100, 100)));
1669 test_large_blur_input(reporter, surface->getCanvas()); 1669 test_large_blur_input(reporter, surface->getCanvas());
1670 } 1670 }
1671 1671
1672 #if SK_SUPPORT_GPU 1672 #if SK_SUPPORT_GPU
1673 1673
1674 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) { 1674 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
1675 1675
1676 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, 1676 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
1677 SkBudgeted::kNo, 1677 SkBudgeted::kNo,
1678 SkImageInfo::MakeN32Premul (100, 100))); 1678 SkImageInfo::MakeN32Premul (100, 100)));
1679 1679
1680 1680
1681 SkCanvas* canvas = surf->getCanvas(); 1681 SkCanvas* canvas = surf->getCanvas();
1682 1682
1683 test_huge_blur(canvas, reporter); 1683 test_huge_blur(canvas, reporter);
1684 } 1684 }
1685 1685
1686 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, repor ter, ctxInfo) { 1686 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, repor ter, ctxInfo) {
1687 1687
1688 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, 1688 sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
1689 SkBudgeted::kNo, 1689 SkBudgeted::kNo,
1690 SkImageInfo::MakeN32Premul (1, 1))); 1690 SkImageInfo::MakeN32Premul (1, 1)));
1691 1691
1692 1692
1693 SkCanvas* canvas = surf->getCanvas(); 1693 SkCanvas* canvas = surf->getCanvas();
1694 1694
1695 test_xfermode_cropped_input(canvas, reporter); 1695 test_xfermode_cropped_input(canvas, reporter);
1696 } 1696 }
1697 1697
1698 DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo ) { 1698 DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo ) {
1699 auto surface(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kYe s, 1699 auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kY es,
1700 SkImageInfo::MakeN32Premul(100, 100 ))); 1700 SkImageInfo::MakeN32Premul(100, 100 )));
1701 test_large_blur_input(reporter, surface->getCanvas()); 1701 test_large_blur_input(reporter, surface->getCanvas());
1702 } 1702 }
1703 #endif 1703 #endif
1704 1704
1705 /* 1705 /*
1706 * Test that colorfilterimagefilter does not require its CTM to be decomposed w hen it has more 1706 * Test that colorfilterimagefilter does not require its CTM to be decomposed w hen it has more
1707 * than just scale/translate, but that other filters do. 1707 * than just scale/translate, but that other filters do.
1708 */ 1708 */
1709 DEF_TEST(ImageFilterComplexCTM, reporter) { 1709 DEF_TEST(ImageFilterComplexCTM, reporter) {
(...skipping 16 matching lines...) Expand all
1726 { SkColorFilterImageFilter::Make(cf, blif), false }, 1726 { SkColorFilterImageFilter::Make(cf, blif), false },
1727 { SkMergeImageFilter::Make(cfif, blif), false }, 1727 { SkMergeImageFilter::Make(cfif, blif), false },
1728 { SkComposeImageFilter::Make(blif, cfif), false }, 1728 { SkComposeImageFilter::Make(blif, cfif), false },
1729 }; 1729 };
1730 1730
1731 for (const auto& rec : recs) { 1731 for (const auto& rec : recs) {
1732 const bool canHandle = rec.fFilter->canHandleComplexCTM(); 1732 const bool canHandle = rec.fFilter->canHandleComplexCTM();
1733 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle); 1733 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle);
1734 } 1734 }
1735 } 1735 }
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