diff options
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 509b972..88ee362 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -921,7 +921,31 @@ public class Allocation extends BaseObj { if (type.getID() == 0) { throw new RSInvalidStateException("Bad Type"); } - int id = rs.nAllocationCreateTyped(type.getID(), mips.mID, usage); + int id = rs.nAllocationCreateTyped(type.getID(), mips.mID, usage, 0); + if (id == 0) { + throw new RSRuntimeException("Allocation creation failed."); + } + return new Allocation(id, rs, type, usage); + } + + /** + * @hide + * This API is hidden and only intended to be used for + * transitional purposes. + * + * @param type renderscript type describing data layout + * @param mips specifies desired mipmap behaviour for the + * allocation + * @param usage bit field specifying how the allocation is + * utilized + */ + static public Allocation createTyped(RenderScript rs, Type type, MipmapControl mips, + int usage, int pointer) { + rs.validate(); + if (type.getID() == 0) { + throw new RSInvalidStateException("Bad Type"); + } + int id = rs.nAllocationCreateTyped(type.getID(), mips.mID, usage, pointer); if (id == 0) { throw new RSRuntimeException("Allocation creation failed."); } @@ -976,7 +1000,7 @@ public class Allocation extends BaseObj { b.setX(count); Type t = b.create(); - int id = rs.nAllocationCreateTyped(t.getID(), MipmapControl.MIPMAP_NONE.mID, usage); + int id = rs.nAllocationCreateTyped(t.getID(), MipmapControl.MIPMAP_NONE.mID, usage, 0); if (id == 0) { throw new RSRuntimeException("Allocation creation failed."); } |