diff options
author | Jason Sams <jsams@google.com> | 2012-10-02 15:21:11 -0700 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2012-10-02 15:21:11 -0700 |
commit | 31864d76a3624f2c5908218b32bf09051b1b9d24 (patch) | |
tree | 96a11f2d3e44b854a317c55047a0d95875f5d494 /tests | |
parent | 3750db176adbaf3f9779df5eadf335f673b2ac4f (diff) | |
download | frameworks_base-31864d76a3624f2c5908218b32bf09051b1b9d24.zip frameworks_base-31864d76a3624f2c5908218b32bf09051b1b9d24.tar.gz frameworks_base-31864d76a3624f2c5908218b32bf09051b1b9d24.tar.bz2 |
Fix range on blur intrinsic.
The intrinsic fails when the radius was 0. A blur
of radius 0 is a nop and should be disallowed. Fix the
test to allow sub-pixel radius to be selected.
bug 7273437
Change-Id: I2805674e29d557615eb7ac65c7910d4dffa28b58
Diffstat (limited to 'tests')
-rw-r--r-- | tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java index a2e4298..0c6d41d 100644 --- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java +++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java @@ -33,7 +33,7 @@ public class Blur25 extends TestBase { private int MAX_RADIUS = 25; private ScriptC_threshold mScript; - private int mRadius = MAX_RADIUS; + private float mRadius = MAX_RADIUS; private float mSaturation = 1.0f; private Allocation mScratchPixelsAllocation1; private Allocation mScratchPixelsAllocation2; @@ -51,13 +51,14 @@ public class Blur25 extends TestBase { public void onBar1Changed(int progress) { - float fRadius = progress / 100.0f; - fRadius *= (float)(MAX_RADIUS); - mRadius = (int)fRadius; + mRadius = ((float)progress) / 100.0f * MAX_RADIUS; + if (mRadius <= 0.10f) { + mRadius = 0.10f; + } if (mUseIntrinsic) { mIntrinsic.setRadius(mRadius); } else { - mScript.invoke_setRadius(mRadius); + mScript.invoke_setRadius((int)mRadius); } } @@ -111,7 +112,7 @@ public class Blur25 extends TestBase { if (mUseIntrinsic) { mIntrinsic.setRadius(mRadius); } else { - mScript.invoke_setRadius(mRadius); + mScript.invoke_setRadius((int)mRadius); } } } |