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

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: copy dst rather than src 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..439bf038d4c36b1b4341ce1f6cf4cd48539f2fd6 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -749,6 +749,26 @@ 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.
+ {
robertphillips 2016/03/16 13:54:53 add \n somewhere in here to limit to 100 cols ?
jbroman 2016/03/16 14:51:37 Done.
+ SkAutoTUnref<SkImageFilter> composite(SkXfermodeImageFilter::Create(nullptr, offset.get(), nullptr));
+ SkRect bounds = SkRect::MakeWH(100, 100);
robertphillips 2016/03/16 13:54:53 add 'what' after that's ?
jbroman 2016/03/16 14:51:37 Done.
+ // Intentionally aliasing here, as that's the real callers do.
+ composite->computeFastBounds(bounds, &bounds);
+ REPORTER_ASSERT(reporter, bounds == SkRect::MakeWH(150, 100));
+ }
+ {
robertphillips 2016/03/16 13:54:53 \n in here too
jbroman 2016/03/16 14:51:37 Done.
+ SkAutoTUnref<SkImageFilter> composite(SkXfermodeImageFilter::Create(nullptr, nullptr, offset.get()));
+ SkRect bounds = SkRect::MakeWH(100, 100);
+ // Intentionally aliasing here, as that's 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