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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1800263002: Fix pointer aliasing bug in SkImageFilter::computeFastBounds. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: code review comments on unit test Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 3def8f5cca82134f36ef733f9e20d38f7381bb22..48e06e079530b667285046f6cea9c3c805b3204e 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -749,6 +749,28 @@ DEF_TEST(ImageFilterComposedBlurFastBounds, reporter) {
REPORTER_ASSERT(reporter, boundsDst == expectedBounds);
}
+DEF_TEST(ImageFilterUnionBounds, reporter) {
+ SkAutoTUnref<SkImageFilter> offset(SkOffsetImageFilter::Create(50, 0));
+ // Regardless of which order they appear in, the image filter bounds should
+ // be combined correctly.
+ {
+ SkAutoTUnref<SkImageFilter> composite(SkXfermodeImageFilter::Create(
+ nullptr, offset.get(), nullptr));
+ SkRect bounds = SkRect::MakeWH(100, 100);
+ // Intentionally aliasing here, as that's what the real callers do.
+ composite->computeFastBounds(bounds, &bounds);
+ REPORTER_ASSERT(reporter, bounds == SkRect::MakeWH(150, 100));
+ }
+ {
+ SkAutoTUnref<SkImageFilter> composite(SkXfermodeImageFilter::Create(
+ nullptr, nullptr, offset.get()));
+ SkRect bounds = SkRect::MakeWH(100, 100);
+ // Intentionally aliasing here, as that's what the real callers do.
+ composite->computeFastBounds(bounds, &bounds);
+ REPORTER_ASSERT(reporter, bounds == SkRect::MakeWH(150, 100));
+ }
+}
+
static void test_imagefilter_merge_result_size(SkImageFilter::Proxy* proxy,
skiatest::Reporter* reporter,
GrContext* context) {
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698