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
This commit is contained in:
parent
cdd0f92b1a
commit
06342a2666
@ -50,3 +50,8 @@ rrect_clip_aa
|
||||
# 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
|
||||
|
@ -84,9 +84,10 @@ bool SkOffsetImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user