diff options
| author | 2017-04-18 14:04:55 -0700 | |
|---|---|---|
| committer | 2017-04-20 15:32:37 -0700 | |
| commit | 67c59949b56bbf051662bbbe9d2bf13c68a0aa7d (patch) | |
| tree | 95cca6555235d96eecf59052e5f72295b44b4f57 | |
| parent | 5d25f429bf6bedb97ab0b27187224da6200dedf6 (diff) | |
Validates Intrinsic Blur only takes 2D Allocations
Bug: 24555166
Test: RSTest on x86_64 emulator
Change-Id: I0c8c970ce85989c3213fb4986e517ac0be5beb26
(cherry picked from commit bb671376ff85066499bf59e32d6138a73fb06f91)
| -rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicBlur.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/ScriptIntrinsicBlur.java b/rs/java/android/renderscript/ScriptIntrinsicBlur.java index 7a702e877a2e..a36873e34d8c 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicBlur.java +++ b/rs/java/android/renderscript/ScriptIntrinsicBlur.java @@ -59,6 +59,9 @@ public final class ScriptIntrinsicBlur extends ScriptIntrinsic { * @param ain The input allocation */ public void setInput(Allocation ain) { + if (ain.getType().getY() == 0) { + throw new RSIllegalArgumentException("Input set to a 1D Allocation"); + } mInput = ain; setVar(1, ain); } @@ -85,6 +88,9 @@ public final class ScriptIntrinsicBlur extends ScriptIntrinsic { * type. */ public void forEach(Allocation aout) { + if (aout.getType().getY() == 0) { + throw new RSIllegalArgumentException("Output is a 1D Allocation"); + } forEach(0, (Allocation) null, aout, null); } @@ -97,6 +103,9 @@ public final class ScriptIntrinsicBlur extends ScriptIntrinsic { * @param opt LaunchOptions for clipping */ public void forEach(Allocation aout, Script.LaunchOptions opt) { + if (aout.getType().getY() == 0) { + throw new RSIllegalArgumentException("Output is a 1D Allocation"); + } forEach(0, (Allocation) null, aout, null, opt); } |