aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-12-19 16:51:53 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-20 17:40:39 +0000
commit22c57abe439f200472a14b2341b68ed7c0ce785e (patch)
treea5808215c0bf3cd6da7520511f99fdf1ba294551 /src
parent86cedfc315886037a0fba6d72ba53bf47bd0b539 (diff)
Fix mapping from src to dst image space in SkAlphaThresholdFilter
This CL does 3 things: It updates the imagealphathreshold GMs so they would've caught this bug It updates SkAlphaImageThresholdFilter to fix the bug It updates the imagealphathreshold_surface GM to match the imagealphathreshold_crop GM (which it was, presumably, originally written to do) The bug in question is that the prior mapping from src to dst space was correct as long as the imageOffset was (0, 0). BUG=675332 Change-Id: I3aa1f463a2234576fb2277797caa2fc4aba2650d Reviewed-on: https://skia-review.googlesource.com/6291 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Stephan White <senorblanco@chromium.org> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index 6cf1ce61e4..81416e2817 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -225,8 +225,9 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage*
U8CPU outerThreshold = (U8CPU)(fOuterThreshold * 0xFF);
SkColor* dptr = dst.getAddr32(0, 0);
int dstWidth = dst.width(), dstHeight = dst.height();
+ SkIPoint srcOffset = { bounds.fLeft - inputOffset.fX, bounds.fTop - inputOffset.fY };
for (int y = 0; y < dstHeight; ++y) {
- const SkColor* sptr = inputBM.getAddr32(bounds.fLeft, bounds.fTop+y);
+ const SkColor* sptr = inputBM.getAddr32(srcOffset.fX, srcOffset.fY+y);
for (int x = 0; x < dstWidth; ++x) {
const SkColor& source = sptr[x];