diff options
-rw-r--r-- | include/effects/SkImageSource.h | 2 | ||||
-rw-r--r-- | src/effects/SkImageSource.cpp | 7 | ||||
-rw-r--r-- | tests/ImageFilterTest.cpp | 46 |
3 files changed, 2 insertions, 53 deletions
diff --git a/include/effects/SkImageSource.h b/include/effects/SkImageSource.h index f2c1274f29..04348c68e8 100644 --- a/include/effects/SkImageSource.h +++ b/include/effects/SkImageSource.h @@ -31,8 +31,6 @@ protected: SkIPoint* offset) const override; sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override; - SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) const override; - private: explicit SkImageSource(sk_sp<SkImage>); SkImageSource(sk_sp<SkImage>, diff --git a/src/effects/SkImageSource.cpp b/src/effects/SkImageSource.cpp index 8ab02ce0cb..cd2fb51e94 100644 --- a/src/effects/SkImageSource.cpp +++ b/src/effects/SkImageSource.cpp @@ -146,13 +146,6 @@ SkRect SkImageSource::computeFastBounds(const SkRect& src) const { return fDstRect; } -SkIRect SkImageSource::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm, - MapDirection direction) const { - SkRect bounds = kForward_MapDirection == direction ? fDstRect : fSrcRect; - ctm.mapRect(&bounds); - return bounds.roundOut(); -} - #ifndef SK_IGNORE_TO_STRING void SkImageSource::toString(SkString* str) const { str->appendf("SkImageSource: ("); diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index b6d4c7b37b..05c0bffbea 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -1941,7 +1941,7 @@ DEF_TEST(ImageFilterColorSpaceDAG, reporter) { REPORTER_ASSERT(reporter, filter->cloneCount() == 1u); } -// Test SkXfermodeImageFilter::filterBounds with different blending modes. +// Test XfermodeimageFilter::onFilterBounds with different blending modes. DEF_TEST(XfermodeImageFilterBounds, reporter) { SkIRect background_rect = SkIRect::MakeXYWH(0, 0, 100, 100); SkIRect foreground_rect = SkIRect::MakeXYWH(50, 50, 100, 100); @@ -2049,50 +2049,8 @@ static void test_arithmetic_combinations(skiatest::Reporter* reporter, float v) test_arithmetic_bounds(reporter, v, v, v, v, background, foreground, &crop, crop_rect); } -// Test SkArithmeticImageFilter::filterBounds with different blending modes. +// Test ArithmeticImageFilter::onFilterBounds with different blending modes. DEF_TEST(ArithmeticImageFilterBounds, reporter) { test_arithmetic_combinations(reporter, 1); test_arithmetic_combinations(reporter, 0.5); } - -// Test SkImageSource::filterBounds. -DEF_TEST(ImageSourceBounds, reporter) { - sk_sp<SkImage> image(SkImage::MakeFromBitmap(make_gradient_circle(64, 64))); - // Default src and dst rects. - sk_sp<SkImageFilter> source1(SkImageSource::Make(image)); - SkIRect imageBounds = SkIRect::MakeWH(64, 64); - SkIRect input(SkIRect::MakeXYWH(10, 20, 30, 40)); // The values don't matter. - REPORTER_ASSERT(reporter, - imageBounds == source1->filterBounds(input, SkMatrix::I(), - SkImageFilter::kForward_MapDirection)); - REPORTER_ASSERT(reporter, - imageBounds == source1->filterBounds(input, SkMatrix::I(), - SkImageFilter::kReverse_MapDirection)); - SkMatrix scale(SkMatrix::MakeScale(2)); - SkIRect scaledBounds = SkIRect::MakeWH(128, 128); - REPORTER_ASSERT(reporter, - scaledBounds == source1->filterBounds(input, scale, - SkImageFilter::kForward_MapDirection)); - REPORTER_ASSERT(reporter, - scaledBounds == source1->filterBounds(input, scale, - SkImageFilter::kReverse_MapDirection)); - - // Specified src and dst rects. - SkRect src(SkRect::MakeXYWH(0.5, 0.5, 100.5, 100.5)); - SkRect dst(SkRect::MakeXYWH(-10.5, -10.5, 120.5, 120.5)); - sk_sp<SkImageFilter> source2(SkImageSource::Make(image, src, dst, kMedium_SkFilterQuality)); - REPORTER_ASSERT(reporter, - dst.roundOut() == source2->filterBounds(input, SkMatrix::I(), - SkImageFilter::kForward_MapDirection)); - REPORTER_ASSERT(reporter, - src.roundOut() == source2->filterBounds(input, SkMatrix::I(), - SkImageFilter::kReverse_MapDirection)); - scale.mapRect(&dst); - scale.mapRect(&src); - REPORTER_ASSERT(reporter, - dst.roundOut() == source2->filterBounds(input, scale, - SkImageFilter::kForward_MapDirection)); - REPORTER_ASSERT(reporter, - src.roundOut() == source2->filterBounds(input, scale, - SkImageFilter::kReverse_MapDirection)); -} |