summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2013-02-07 02:17:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-07 02:17:53 +0000
commit3c6721899ea903ed278feac1e76a97137fa9d0c3 (patch)
treee0f477c82cdd68e3217b77d32b079cb6d1c7019d /graphics/java/android/renderscript/Allocation.java
parent154be52ae785a00ed091175e3eeed36d8ad14999 (diff)
parent455d64426615e5d269a3bd05cd91b67c3811fcdf (diff)
Merge "Implement rs.sendMessage()"
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r--graphics/java/android/renderscript/Allocation.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index ea02a17041ea..5f0844af2f52 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -1466,6 +1466,10 @@ public class Allocation extends BaseObj {
* Creates a non-mipmapped renderscript allocation to use as a
* graphics texture from the bitmap referenced by resource id
*
+ * With target API version 18 or greater, this allocation will be
+ * created with USAGE_SHARED. With target API version 17 or lower,
+ * this allocation will be created with USAGE_GRAPHICS_TEXTURE.
+ *
* @param rs Context to which the allocation will belong.
* @param res application resources
* @param id resource id to load the data from
@@ -1476,6 +1480,11 @@ public class Allocation extends BaseObj {
static public Allocation createFromBitmapResource(RenderScript rs,
Resources res,
int id) {
+ if (rs.getApplicationContext().getApplicationInfo().targetSdkVersion >= 18) {
+ return createFromBitmapResource(rs, res, id,
+ MipmapControl.MIPMAP_NONE,
+ USAGE_SHARED | USAGE_SCRIPT);
+ }
return createFromBitmapResource(rs, res, id,
MipmapControl.MIPMAP_NONE,
USAGE_GRAPHICS_TEXTURE);