Remove "predefined" elements from Java layer. Static elements continue to exist but are no longer treated as a special version of element.
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index e6cb395..7749ad34 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -209,35 +209,24 @@
static public Allocation createSized(RenderScript rs, Element e, int count)
throws IllegalArgumentException {
- int id;
- if(e.mIsPredefined) {
- id = rs.nAllocationCreatePredefSized(e.mPredefinedID, count);
- } else {
- id = rs.nAllocationCreateSized(e.mID, count);
- if(id == 0) {
- throw new IllegalStateException("Bad element.");
- }
+ int id = rs.nAllocationCreateSized(e.mID, count);
+ if(id == 0) {
+ throw new IllegalStateException("Bad element.");
}
return new Allocation(id, rs, null);
}
static public Allocation createFromBitmap(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips)
throws IllegalArgumentException {
- if(!dstFmt.mIsPredefined) {
- throw new IllegalStateException("Attempting to allocate a bitmap with a non-static element.");
- }
- int id = rs.nAllocationCreateFromBitmap(dstFmt.mPredefinedID, genMips, b);
+ int id = rs.nAllocationCreateFromBitmap(dstFmt.mID, genMips, b);
return new Allocation(id, rs, null);
}
static public Allocation createFromBitmapBoxed(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips)
throws IllegalArgumentException {
- if(!dstFmt.mIsPredefined) {
- throw new IllegalStateException("Attempting to allocate a bitmap with a non-static element.");
- }
- int id = rs.nAllocationCreateFromBitmapBoxed(dstFmt.mPredefinedID, genMips, b);
+ int id = rs.nAllocationCreateFromBitmapBoxed(dstFmt.mID, genMips, b);
return new Allocation(id, rs, null);
}
@@ -250,10 +239,10 @@
is = res.openRawResource(id, value);
int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
- int allocationId = rs.nAllocationCreateFromAssetStream(dstFmt.mPredefinedID, genMips,
+ int allocationId = rs.nAllocationCreateFromAssetStream(dstFmt.mID, genMips,
asset);
- return new Allocation(allocationId, rs, null);
+ return new Allocation(allocationId, rs, null);
} catch (Exception e) {
// Ignore
} finally {