summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2013-06-17 18:35:31 -0700
committerJason Sams <jsams@google.com>2013-06-18 17:39:10 -0700
commit048c978ae599ecc9e00d68040ae9fd8a9d46df64 (patch)
treec74801589345f96259bf6b66a83b50d46d41d365
parent8ace2acbf16deb300a58e13fab5bbd28ff2d808c (diff)
downloadframeworks_base-048c978ae599ecc9e00d68040ae9fd8a9d46df64.zip
frameworks_base-048c978ae599ecc9e00d68040ae9fd8a9d46df64.tar.gz
frameworks_base-048c978ae599ecc9e00d68040ae9fd8a9d46df64.tar.bz2
Allow single channel and float convolve.
Change-Id: If448ea2ae38de2f8b95fc884ea0dbf8222964012
-rw-r--r--graphics/java/android/renderscript/ScriptIntrinsicConvolve3x3.java5
-rw-r--r--graphics/java/android/renderscript/ScriptIntrinsicConvolve5x5.java7
2 files changed, 11 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/ScriptIntrinsicConvolve3x3.java b/graphics/java/android/renderscript/ScriptIntrinsicConvolve3x3.java
index c9c54b2..d54b675 100644
--- a/graphics/java/android/renderscript/ScriptIntrinsicConvolve3x3.java
+++ b/graphics/java/android/renderscript/ScriptIntrinsicConvolve3x3.java
@@ -48,7 +48,10 @@ public final class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {
*/
public static ScriptIntrinsicConvolve3x3 create(RenderScript rs, Element e) {
float f[] = { 0, 0, 0, 0, 1, 0, 0, 0, 0};
- if (!e.isCompatible(Element.U8_4(rs))) {
+ if (!e.isCompatible(Element.U8(rs)) &&
+ !e.isCompatible(Element.U8_4(rs)) &&
+ !e.isCompatible(Element.F32(rs)) &&
+ !e.isCompatible(Element.F32_4(rs))) {
throw new RSIllegalArgumentException("Unsuported element type.");
}
int id = rs.nScriptIntrinsicCreate(1, e.getID(rs));
diff --git a/graphics/java/android/renderscript/ScriptIntrinsicConvolve5x5.java b/graphics/java/android/renderscript/ScriptIntrinsicConvolve5x5.java
index c6e1e39..da4d5a2 100644
--- a/graphics/java/android/renderscript/ScriptIntrinsicConvolve5x5.java
+++ b/graphics/java/android/renderscript/ScriptIntrinsicConvolve5x5.java
@@ -48,6 +48,13 @@ public final class ScriptIntrinsicConvolve5x5 extends ScriptIntrinsic {
* @return ScriptIntrinsicConvolve5x5
*/
public static ScriptIntrinsicConvolve5x5 create(RenderScript rs, Element e) {
+ if (!e.isCompatible(Element.U8(rs)) &&
+ !e.isCompatible(Element.U8_4(rs)) &&
+ !e.isCompatible(Element.F32(rs)) &&
+ !e.isCompatible(Element.F32_4(rs))) {
+ throw new RSIllegalArgumentException("Unsuported element type.");
+ }
+
int id = rs.nScriptIntrinsicCreate(4, e.getID(rs));
return new ScriptIntrinsicConvolve5x5(id, rs);