Index: src/effects/SkDisplacementMapEffect.cpp |
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp |
index 6e5c910edf4f6f04a670841d2906587e95115675..f43287c4d7fcfaa0a3bc9c949a7c78a2f74e1ad6 100644 |
--- a/src/effects/SkDisplacementMapEffect.cpp |
+++ b/src/effects/SkDisplacementMapEffect.cpp |
@@ -205,6 +205,14 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, |
if (!this->applyCropRect(&bounds, ctm)) { |
return false; |
} |
+ SkIRect displBounds; |
+ displ.getBounds(&displBounds); |
+ if (!this->applyCropRect(&displBounds, ctm)) { |
+ return false; |
+ } |
+ if (!bounds.intersect(displBounds)) { |
+ return false; |
+ } |
dst->setConfig(color.config(), bounds.width(), bounds.height()); |
dst->allocPixels(); |
@@ -338,6 +346,14 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, |
if (!this->applyCropRect(&bounds, ctm)) { |
return false; |
} |
+ SkIRect displBounds; |
+ displacementBM.getBounds(&displBounds); |
+ if (!this->applyCropRect(&displBounds, ctm)) { |
+ return false; |
+ } |
+ if (!bounds.intersect(displBounds)) { |
+ return false; |
+ } |
SkRect srcRect = SkRect::Make(bounds); |
SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); |
context->drawRectToRect(paint, dstRect, srcRect); |