diff options
author | Jason Sams <jsams@google.com> | 2013-02-05 19:20:18 -0800 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2013-02-05 19:20:18 -0800 |
commit | 455d64426615e5d269a3bd05cd91b67c3811fcdf (patch) | |
tree | 25014401d9053c07d9d4091ef65e6a15dde5913f /graphics/java/android/renderscript/Allocation.java | |
parent | a4b7bc97862e01d38b483524f1d1cf433d29e294 (diff) |
Implement rs.sendMessage()
Change-Id: Ib4f4bb7bb4f697d0b5405ad55721394ed2456c65
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 5e9872fa7249..22434dd0f428 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); |