Fix GPU displacement with expanding crop rects.
Fix GPU displacement with expanding crop rects, and re-enable the
imagefilterscropexpand GM. There were two bugs: the result texture was
being created at input color bitmap size, not the cropped bounds size,
and the matrix in GrContext was not being set to identity before draw.
R=junov@chromium.org
Review URL: https://codereview.chromium.org/195973007
git-svn-id: http://skia.googlecode.com/svn/trunk@13844 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 4b26a5f..0200cab 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -384,8 +384,8 @@
GrTextureDesc desc;
desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
- desc.fWidth = colorBM.width();
- desc.fHeight = colorBM.height();
+ desc.fWidth = bounds.width();
+ desc.fHeight = bounds.height();
desc.fConfig = kSkia8888_GrPixelConfig;
GrAutoScratchTexture ast(context, desc);
@@ -410,6 +410,8 @@
color))->unref();
SkIRect colorBounds = bounds;
colorBounds.offset(-colorOffset);
+ GrContext::AutoMatrix am;
+ am.setIdentity(context);
SkMatrix matrix;
matrix.setTranslate(-SkIntToScalar(colorBounds.x()),
-SkIntToScalar(colorBounds.y()));