diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 17:00:46 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 17:00:46 +0000 |
commit | 6d7296aaa0ec8be655cdf1ef5b53c27bc0843670 (patch) | |
tree | 3ad58e63668dd8e343ac55f3d92430f32789e37d | |
parent | 5f6c2c0477a8f1b5f2df3f403387bd457133f920 (diff) |
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
-rw-r--r-- | expectations/gm/ignored-tests.txt | 3 | ||||
-rw-r--r-- | gm/displacement.cpp | 10 | ||||
-rw-r--r-- | src/effects/SkDisplacementMapEffect.cpp | 5 |
3 files changed, 15 insertions, 3 deletions
diff --git a/expectations/gm/ignored-tests.txt b/expectations/gm/ignored-tests.txt index 2872e7e481..b8a901996c 100644 --- a/expectations/gm/ignored-tests.txt +++ b/expectations/gm/ignored-tests.txt @@ -66,3 +66,6 @@ clipped-bitmap-shaders-tile-hq_gpu clipped-bitmap-shaders-clamp-hq_angle clipped-bitmap-shaders-mirror-hq_angle clipped-bitmap-shaders-tile-hq_angle + +# Added by sugoi for added test in https://codereview.chromium.org/104853005 +displacement diff --git a/gm/displacement.cpp b/gm/displacement.cpp index 5a20f8187b..cc664012da 100644 --- a/gm/displacement.cpp +++ b/gm/displacement.cpp @@ -183,6 +183,7 @@ protected: 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 @@ protected: 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: diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 8fc4c86ec5..3087b63c7a 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -183,12 +183,11 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, const SkMatrix& ctm, SkBitmap* dst, SkIPoint* offset) { - SkBitmap displ, color = src; + SkBitmap displ = src, color = src; SkImageFilter* colorInput = getColorInput(); SkImageFilter* displacementInput = getDisplacementInput(); - SkASSERT(NULL != displacementInput); if ((colorInput && !colorInput->filterImage(proxy, src, ctm, &color, offset)) || - !displacementInput || !displacementInput->filterImage(proxy, src, ctm, &displ, offset)) { + (displacementInput && !displacementInput->filterImage(proxy, src, ctm, &displ, offset))) { return false; } if ((displ.config() != SkBitmap::kARGB_8888_Config) || |