Cleanup subdata apis

Change-Id: I70d0d5e4ca2b42f3a9cbf854fe47917cee8f46df
This commit is contained in:
Jason Sams
2011-01-07 17:00:07 -08:00
parent e4aff7c6bf
commit fa445b9353
3 changed files with 309 additions and 191 deletions

View File

@@ -165977,6 +165977,175 @@
deprecated="not deprecated" deprecated="not deprecated"
visibility="public" visibility="public"
> >
<method name="copy1DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="int[]">
</parameter>
</method>
<method name="copy1DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="short[]">
</parameter>
</method>
<method name="copy1DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="byte[]">
</parameter>
</method>
<method name="copy1DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="float[]">
</parameter>
</method>
<method name="copy2DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="yoff" type="int">
</parameter>
<parameter name="w" type="int">
</parameter>
<parameter name="h" type="int">
</parameter>
<parameter name="d" type="byte[]">
</parameter>
</method>
<method name="copy2DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="yoff" type="int">
</parameter>
<parameter name="w" type="int">
</parameter>
<parameter name="h" type="int">
</parameter>
<parameter name="d" type="short[]">
</parameter>
</method>
<method name="copy2DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="yoff" type="int">
</parameter>
<parameter name="w" type="int">
</parameter>
<parameter name="h" type="int">
</parameter>
<parameter name="d" type="int[]">
</parameter>
</method>
<method name="copy2DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="yoff" type="int">
</parameter>
<parameter name="w" type="int">
</parameter>
<parameter name="h" type="int">
</parameter>
<parameter name="d" type="float[]">
</parameter>
</method>
<method name="copy2DRangeFrom"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="yoff" type="int">
</parameter>
<parameter name="b" type="android.graphics.Bitmap">
</parameter>
</method>
<method name="copyFrom" <method name="copyFrom"
return="void" return="void"
abstract="false" abstract="false"
@@ -166068,6 +166237,58 @@
<parameter name="b" type="android.graphics.Bitmap"> <parameter name="b" type="android.graphics.Bitmap">
</parameter> </parameter>
</method> </method>
<method name="copyTo"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="d" type="byte[]">
</parameter>
</method>
<method name="copyTo"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="d" type="short[]">
</parameter>
</method>
<method name="copyTo"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="d" type="int[]">
</parameter>
</method>
<method name="copyTo"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="d" type="float[]">
</parameter>
</method>
<method name="createCubemapFromBitmap" <method name="createCubemapFromBitmap"
return="android.renderscript.Allocation" return="android.renderscript.Allocation"
abstract="false" abstract="false"
@@ -166293,32 +166514,6 @@
visibility="public" visibility="public"
> >
</method> </method>
<method name="readData"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="d" type="int[]">
</parameter>
</method>
<method name="readData"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="d" type="float[]">
</parameter>
</method>
<method name="resize" <method name="resize"
return="void" return="void"
abstract="false" abstract="false"
@@ -166332,148 +166527,6 @@
<parameter name="dimX" type="int"> <parameter name="dimX" type="int">
</parameter> </parameter>
</method> </method>
<method name="subData"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="fp" type="android.renderscript.FieldPacker">
</parameter>
</method>
<method name="subData1D"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="int[]">
</parameter>
</method>
<method name="subData1D"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="short[]">
</parameter>
</method>
<method name="subData1D"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="byte[]">
</parameter>
</method>
<method name="subData1D"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="off" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
<parameter name="d" type="float[]">
</parameter>
</method>
<method name="subData2D"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="yoff" type="int">
</parameter>
<parameter name="w" type="int">
</parameter>
<parameter name="h" type="int">
</parameter>
<parameter name="d" type="int[]">
</parameter>
</method>
<method name="subData2D"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="yoff" type="int">
</parameter>
<parameter name="w" type="int">
</parameter>
<parameter name="h" type="int">
</parameter>
<parameter name="d" type="float[]">
</parameter>
</method>
<method name="subElementData"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="xoff" type="int">
</parameter>
<parameter name="component_number" type="int">
</parameter>
<parameter name="fp" type="android.renderscript.FieldPacker">
</parameter>
</method>
<method name="syncAll" <method name="syncAll"
return="void" return="void"
abstract="false" abstract="false"
@@ -258107,7 +258160,7 @@
deprecated="not deprecated" deprecated="not deprecated"
visibility="public" visibility="public"
> >
<parameter name="t" type="T"> <parameter name="arg0" type="T">
</parameter> </parameter>
</method> </method>
</interface> </interface>

View File

@@ -126,7 +126,7 @@ public class Allocation extends BaseObj {
for (int ct=0; ct < d.length; ct++) { for (int ct=0; ct < d.length; ct++) {
i[ct] = d[ct].getID(); i[ct] = d[ct].getID();
} }
subData1D(0, mType.getCount(), i); copy1DRangeFrom(0, mType.getCount(), i);
} }
private void validateBitmap(Bitmap b) { private void validateBitmap(Bitmap b) {
@@ -139,32 +139,35 @@ public class Allocation extends BaseObj {
public void copyFrom(int[] d) { public void copyFrom(int[] d) {
mRS.validate(); mRS.validate();
subData1D(0, mType.getCount(), d); copy1DRangeFrom(0, mType.getCount(), d);
} }
public void copyFrom(short[] d) { public void copyFrom(short[] d) {
mRS.validate(); mRS.validate();
subData1D(0, mType.getCount(), d); copy1DRangeFrom(0, mType.getCount(), d);
} }
public void copyFrom(byte[] d) { public void copyFrom(byte[] d) {
mRS.validate(); mRS.validate();
subData1D(0, mType.getCount(), d); copy1DRangeFrom(0, mType.getCount(), d);
} }
public void copyFrom(float[] d) { public void copyFrom(float[] d) {
mRS.validate(); mRS.validate();
subData1D(0, mType.getCount(), d); copy1DRangeFrom(0, mType.getCount(), d);
} }
public void copyFrom(Bitmap b) { public void copyFrom(Bitmap b) {
validateBitmap(b); validateBitmap(b);
mRS.nAllocationCopyFromBitmap(getID(), b); mRS.nAllocationCopyFromBitmap(getID(), b);
} }
public void copyTo(Bitmap b) { /**
validateBitmap(b); * @hide
mRS.nAllocationCopyToBitmap(getID(), b); *
} * This is only intended to be used by auto-generate code reflected from the
* renderscript script files.
*
public void subData(int xoff, FieldPacker fp) { * @param xoff
* @param fp
*/
public void setOneElement(int xoff, FieldPacker fp) {
int eSize = mType.mElement.getSizeBytes(); int eSize = mType.mElement.getSizeBytes();
final byte[] data = fp.getData(); final byte[] data = fp.getData();
@@ -178,7 +181,17 @@ public class Allocation extends BaseObj {
} }
public void subElementData(int xoff, int component_number, FieldPacker fp) { /**
* @hide
*
* This is only intended to be used by auto-generate code reflected from the
* renderscript script files.
*
* @param xoff
* @param component_number
* @param fp
*/
public void setOneComponent(int xoff, int component_number, FieldPacker fp) {
if (component_number >= mType.mElement.mElements.length) { if (component_number >= mType.mElement.mElements.length) {
throw new RSIllegalArgumentException("Component_number " + component_number + " out of range."); throw new RSIllegalArgumentException("Component_number " + component_number + " out of range.");
} }
@@ -214,44 +227,75 @@ public class Allocation extends BaseObj {
} }
} }
public void subData1D(int off, int count, int[] d) { public void copy1DRangeFrom(int off, int count, int[] d) {
int dataSize = mType.mElement.getSizeBytes() * count; int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length * 4, dataSize); data1DChecks(off, count, d.length * 4, dataSize);
mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize); mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
} }
public void subData1D(int off, int count, short[] d) { public void copy1DRangeFrom(int off, int count, short[] d) {
int dataSize = mType.mElement.getSizeBytes() * count; int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length * 2, dataSize); data1DChecks(off, count, d.length * 2, dataSize);
mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize); mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
} }
public void subData1D(int off, int count, byte[] d) { public void copy1DRangeFrom(int off, int count, byte[] d) {
int dataSize = mType.mElement.getSizeBytes() * count; int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length, dataSize); data1DChecks(off, count, d.length, dataSize);
mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize); mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
} }
public void subData1D(int off, int count, float[] d) { public void copy1DRangeFrom(int off, int count, float[] d) {
int dataSize = mType.mElement.getSizeBytes() * count; int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length * 4, dataSize); data1DChecks(off, count, d.length * 4, dataSize);
mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize); mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
} }
public void subData2D(int xoff, int yoff, int w, int h, int[] d) { public void copy2DRangeFrom(int xoff, int yoff, int w, int h, byte[] d) {
mRS.validate();
mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, d, d.length);
}
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, short[] d) {
mRS.validate();
mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, d, d.length * 2);
}
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, int[] d) {
mRS.validate(); mRS.validate();
mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, d, d.length * 4); mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, d, d.length * 4);
} }
public void subData2D(int xoff, int yoff, int w, int h, float[] d) { public void copy2DRangeFrom(int xoff, int yoff, int w, int h, float[] d) {
mRS.validate(); mRS.validate();
mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, d, d.length * 4); mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, d, d.length * 4);
} }
public void readData(int[] d) { public void copy2DRangeFrom(int xoff, int yoff, Bitmap b) {
mRS.validate();
mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, b);
}
public void copyTo(Bitmap b) {
validateBitmap(b);
mRS.nAllocationCopyToBitmap(getID(), b);
}
public void copyTo(byte[] d) {
mRS.validate(); mRS.validate();
mRS.nAllocationRead(getID(), d); mRS.nAllocationRead(getID(), d);
} }
public void readData(float[] d) { public void copyTo(short[] d) {
mRS.validate();
mRS.nAllocationRead(getID(), d);
}
public void copyTo(int[] d) {
mRS.validate();
mRS.nAllocationRead(getID(), d);
}
public void copyTo(float[] d) {
mRS.validate(); mRS.validate();
mRS.nAllocationRead(getID(), d); mRS.nAllocationRead(getID(), d);
} }

View File

@@ -60,7 +60,8 @@ public class RenderScript {
_nInit(); _nInit();
sInitialized = true; sInitialized = true;
} catch (UnsatisfiedLinkError e) { } catch (UnsatisfiedLinkError e) {
Log.d(LOG_TAG, "RenderScript JNI library not found!"); Log.e(LOG_TAG, "Error loading RS jni library: " + e);
throw new RSRuntimeException("Error loading RS jni library: " + e);
} }
} }
@@ -250,6 +251,14 @@ public class RenderScript {
rsnAllocationElementData1D(mContext, id, xoff, mip, compIdx, d, sizeBytes); rsnAllocationElementData1D(mContext, id, xoff, mip, compIdx, d, sizeBytes);
} }
native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, byte[] d, int sizeBytes);
synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, byte[] d, int sizeBytes) {
rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
}
native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, short[] d, int sizeBytes);
synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, short[] d, int sizeBytes) {
rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
}
native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, int[] d, int sizeBytes); native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, int[] d, int sizeBytes);
synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, int[] d, int sizeBytes) { synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, int[] d, int sizeBytes) {
rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes); rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
@@ -258,7 +267,19 @@ public class RenderScript {
synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, float[] d, int sizeBytes) { synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, float[] d, int sizeBytes) {
rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes); rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
} }
native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, Bitmap b);
synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, Bitmap b) {
rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, b);
}
native void rsnAllocationRead(int con, int id, byte[] d);
synchronized void nAllocationRead(int id, byte[] d) {
rsnAllocationRead(mContext, id, d);
}
native void rsnAllocationRead(int con, int id, short[] d);
synchronized void nAllocationRead(int id, short[] d) {
rsnAllocationRead(mContext, id, d);
}
native void rsnAllocationRead(int con, int id, int[] d); native void rsnAllocationRead(int con, int id, int[] d);
synchronized void nAllocationRead(int id, int[] d) { synchronized void nAllocationRead(int id, int[] d) {
rsnAllocationRead(mContext, id, d); rsnAllocationRead(mContext, id, d);