aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-09-18 18:35:05 +0000
committerGravatar Mike Reed <reed@google.com>2017-09-18 20:52:21 +0000
commit2ad0908b6752c97446d824a3b62b05cb2bc7e6ca (patch)
tree4064a37f7b76a803fc97a9f0c849c4807785f77b /tests
parentbf2d373147021d38b4017bfdb61f89f0c0718ae8 (diff)
Revert "Reland "Fix SkImageSource::filterBounds()""
This reverts commit bf12c079707a89f683ad0a6c989127fa20d9d202. Reason for revert: broke the filterfastbounds GM (2nd column, 5th & 7th rows) Original change's description: > Reland "Fix SkImageSource::filterBounds()" > > This relands commit cb4d58766668b003fea67798027fc25d84acd059 > which was reverted by commit b6d2be1330f16fe05f1eed5abda927c0fbb50055 > because the original CL broke some blink layout tests. > > This reland let SkImageSource::filterBounds() return the dst rect with > ctm applied regardless of direction. > > Original description: > > > Previously SkImageSource::filterBounds() uses the default > > SkImageFilter::onFilterNodeBounds() which returns the input rect. > > > > Now override onFilterNodeBounds() in SkImageSource to return src > > or dst rect (with transform applied). > > Change-Id: I915b7889ff59829ddbc4479cd66d75a0bb581e54 > Reviewed-on: https://skia-review.googlesource.com/47501 > Commit-Queue: Stephen White <senorblanco@chromium.org> > Reviewed-by: Stephen White <senorblanco@chromium.org> TBR=senorblanco@chromium.org,reed@google.com,wangxianzhu@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I698433de66cf3de145b9319e09cb9ec9e30d2fa9 Reviewed-on: https://skia-review.googlesource.com/48160 Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ImageFilterTest.cpp46
1 files changed, 2 insertions, 44 deletions
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index d880a0c814..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,
- dst.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,
- dst.roundOut() == source2->filterBounds(input, scale,
- SkImageFilter::kReverse_MapDirection));
-}