summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2013-06-01 00:54:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-06-01 00:54:17 +0000
commit413adc9260d700bd8143950951c4e1ad07cbeddf (patch)
treeac0e647bce5f14be17a760f8fb680c0dbf2f28e0 /graphics/java/android/renderscript/Allocation.java
parent51e01f9ec058f34a27de7687ceddf4eb0e6b7d9d (diff)
parent3ece2f3268a0629383b37604d0712e3f48968ad9 (diff)
Merge "Fix free after use with createFromBitmapResource" into jb-mr2-dev
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r--graphics/java/android/renderscript/Allocation.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 773328c069bf..8ba09e07ff4b 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -1650,6 +1650,9 @@ public class Allocation extends BaseObj {
int usage) {
rs.validate();
+ if ((usage & (USAGE_SHARED | USAGE_IO_INPUT | USAGE_IO_OUTPUT)) != 0) {
+ throw new RSIllegalArgumentException("Unsupported usage specified.");
+ }
Bitmap b = BitmapFactory.decodeResource(res, id);
Allocation alloc = createFromBitmap(rs, b, mips, usage);
b.recycle();
@@ -1677,7 +1680,7 @@ public class Allocation extends BaseObj {
if (rs.getApplicationContext().getApplicationInfo().targetSdkVersion >= 18) {
return createFromBitmapResource(rs, res, id,
MipmapControl.MIPMAP_NONE,
- USAGE_SHARED | USAGE_SCRIPT | USAGE_GRAPHICS_TEXTURE);
+ USAGE_SCRIPT | USAGE_GRAPHICS_TEXTURE);
}
return createFromBitmapResource(rs, res, id,
MipmapControl.MIPMAP_NONE,