Fix SkOffsetImageFilter to use a temporary for bounds computations.
SkOffsetImageFilter::onFilterBounds() was writing to *dst, and later
referring to src. These may be the same memory location, so the results
were incorrect.
Covered by the 5th test case in offsetimagefilter.
BUG=skia:
Review URL: https://codereview.chromium.org/195163004
git-svn-id: http://skia.googlecode.com/svn/trunk@13744 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/expectations/gm/ignored-tests.txt b/expectations/gm/ignored-tests.txt
index 250dc61..4a177f1 100644
--- a/expectations/gm/ignored-tests.txt
+++ b/expectations/gm/ignored-tests.txt
@@ -50,3 +50,8 @@
# I will likely just delete the GM.
canvas-layer-state
+# Fixes correctness for offsetimagefilter; slight pixel diffs for imagefiltersclipped.
+# https://codereview.chromium.org/195163004
+# senorblanco will rebaseline.
+offsetimagefilter
+imagefiltersclipped
diff --git a/src/effects/SkOffsetImageFilter.cpp b/src/effects/SkOffsetImageFilter.cpp
index 6322a5a..12c5af6 100644
--- a/src/effects/SkOffsetImageFilter.cpp
+++ b/src/effects/SkOffsetImageFilter.cpp
@@ -84,9 +84,10 @@
SkVector vec;
ctm.mapVectors(&vec, &fOffset, 1);
- *dst = src;
- dst->offset(-SkScalarCeilToInt(vec.fX), -SkScalarCeilToInt(vec.fY));
- dst->join(src);
+ SkIRect bounds = src;
+ bounds.offset(-SkScalarCeilToInt(vec.fX), -SkScalarCeilToInt(vec.fY));
+ bounds.join(src);
+ *dst = bounds;
return true;
}