Index: src/effects/SkBlurImageFilter.cpp |
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp |
index 41ab9b710744ef6042b42f2090c67d669b7e7d4c..c77a444da5c7a31ddc85fa56da04d30fb2d62687 100644 |
--- a/src/effects/SkBlurImageFilter.cpp |
+++ b/src/effects/SkBlurImageFilter.cpp |
@@ -82,7 +82,7 @@ |
} |
SkIRect srcBounds, dstBounds; |
- if (!this->applyCropRect(ctx, src, srcOffset, &dstBounds, &srcBounds)) { |
+ if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &srcBounds, &src)) { |
return false; |
} |
@@ -91,12 +91,13 @@ |
return false; |
} |
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstBounds.width(), dstBounds.height())); |
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(srcBounds.width(), srcBounds.height())); |
if (!device) { |
return false; |
} |
*dst = device->accessBitmap(false); |
SkAutoLockPixels alp_dst(*dst); |
+ dst->getBounds(&dstBounds); |
SkVector sigma = mapSigma(fSigma, ctx.ctm()); |
@@ -111,8 +112,8 @@ |
if (kernelSizeX == 0 && kernelSizeY == 0) { |
src.copyTo(dst, dst->colorType()); |
- offset->fX = dstBounds.fLeft; |
- offset->fY = dstBounds.fTop; |
+ offset->fX = srcBounds.fLeft; |
+ offset->fY = srcBounds.fTop; |
return true; |
} |
@@ -123,16 +124,13 @@ |
SkBitmap temp = tempDevice->accessBitmap(false); |
SkAutoLockPixels alpTemp(temp); |
- offset->fX = dstBounds.fLeft; |
- offset->fY = dstBounds.fTop; |
+ offset->fX = srcBounds.fLeft; |
+ offset->fY = srcBounds.fTop; |
+ srcBounds.offset(-srcOffset); |
+ const SkPMColor* s = src.getAddr32(srcBounds.left(), srcBounds.top()); |
SkPMColor* t = temp.getAddr32(0, 0); |
SkPMColor* d = dst->getAddr32(0, 0); |
int w = dstBounds.width(), h = dstBounds.height(); |
- const SkPMColor* s = src.getAddr32(srcBounds.x() - srcOffset.x(), srcBounds.y() - srcOffset.y()); |
- srcBounds.offset(-dstBounds.x(), -dstBounds.y()); |
- dstBounds.offset(-dstBounds.x(), -dstBounds.y()); |
- SkIRect srcBoundsT = SkIRect::MakeLTRB(srcBounds.top(), srcBounds.left(), srcBounds.bottom(), srcBounds.right()); |
- SkIRect dstBoundsT = SkIRect::MakeWH(dstBounds.height(), dstBounds.width()); |
int sw = src.rowBytesAsPixels(); |
/** |
@@ -154,20 +152,20 @@ |
* images, and all memory reads are contiguous. |
*/ |
if (kernelSizeX > 0 && kernelSizeY > 0) { |
- SkOpts::box_blur_xx(s, sw, srcBounds, t, kernelSizeX, lowOffsetX, highOffsetX, w, h); |
- SkOpts::box_blur_xx(t, w, dstBounds, d, kernelSizeX, highOffsetX, lowOffsetX, w, h); |
- SkOpts::box_blur_xy(d, w, dstBounds, t, kernelSizeX3, highOffsetX, highOffsetX, w, h); |
- SkOpts::box_blur_xx(t, h, dstBoundsT, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); |
- SkOpts::box_blur_xx(d, h, dstBoundsT, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); |
- SkOpts::box_blur_xy(t, h, dstBoundsT, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); |
+ SkOpts::box_blur_xx(s, sw, t, kernelSizeX, lowOffsetX, highOffsetX, w, h); |
+ SkOpts::box_blur_xx(t, w, d, kernelSizeX, highOffsetX, lowOffsetX, w, h); |
+ SkOpts::box_blur_xy(d, w, t, kernelSizeX3, highOffsetX, highOffsetX, w, h); |
+ SkOpts::box_blur_xx(t, h, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); |
+ SkOpts::box_blur_xx(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); |
+ SkOpts::box_blur_xy(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); |
} else if (kernelSizeX > 0) { |
- SkOpts::box_blur_xx(s, sw, srcBounds, d, kernelSizeX, lowOffsetX, highOffsetX, w, h); |
- SkOpts::box_blur_xx(d, w, dstBounds, t, kernelSizeX, highOffsetX, lowOffsetX, w, h); |
- SkOpts::box_blur_xx(t, w, dstBounds, d, kernelSizeX3, highOffsetX, highOffsetX, w, h); |
+ SkOpts::box_blur_xx(s, sw, d, kernelSizeX, lowOffsetX, highOffsetX, w, h); |
+ SkOpts::box_blur_xx(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h); |
+ SkOpts::box_blur_xx(t, w, d, kernelSizeX3, highOffsetX, highOffsetX, w, h); |
} else if (kernelSizeY > 0) { |
- SkOpts::box_blur_yx(s, sw, srcBoundsT, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); |
- SkOpts::box_blur_xx(d, h, dstBoundsT, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); |
- SkOpts::box_blur_xy(t, h, dstBoundsT, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); |
+ SkOpts::box_blur_yx(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); |
+ SkOpts::box_blur_xx(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); |
+ SkOpts::box_blur_xy(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); |
} |
return true; |
} |