Accept displacement with no displacement input
BUG=
R=senorblanco@google.com, senorblanco@chromium.org, sugoi@google.com, bsalomon@google.com, bsalomon@chromium.org
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/104853005
git-svn-id: http://skia.googlecode.com/svn/trunk@12773 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/displacement.cpp b/gm/displacement.cpp
index 5a20f81..cc66401 100644
--- a/gm/displacement.cpp
+++ b/gm/displacement.cpp
@@ -183,6 +183,7 @@
40.0f, displ, NULL, &cropRect)))->unref();
drawClippedBitmap(canvas, 400, 300, paint);
+ // Tests for images of different sizes
displ.reset(SkNEW_ARGS(SkBitmapSource, (fSmall)));
paint.setImageFilter(SkNEW_ARGS(SkDisplacementMapEffect,
(SkDisplacementMapEffect::kR_ChannelSelectorType,
@@ -207,6 +208,15 @@
SkDisplacementMapEffect::kA_ChannelSelectorType,
40.0f, displ)))->unref();
drawClippedBitmap(canvas, 300, 400, paint);
+
+ // Test for no given displacement input. In this case, both displacement
+ // and color should use the same bitmap, given to SkCanvas::drawBitmap()
+ // as an input argument.
+ paint.setImageFilter(SkNEW_ARGS(SkDisplacementMapEffect,
+ (SkDisplacementMapEffect::kG_ChannelSelectorType,
+ SkDisplacementMapEffect::kA_ChannelSelectorType,
+ 40.0f, NULL)))->unref();
+ drawClippedBitmap(canvas, 400, 400, paint);
}
private: