summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/renderscript
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2013-11-06 11:22:02 -0800
committerJason Sams <jsams@google.com>2013-11-06 11:22:02 -0800
commite729a9400f3ed2234a95a53aadb3420b76436d63 (patch)
tree7b9eb2d7b20e3288bc236249d21818f89169674f /graphics/java/android/renderscript
parentb0a2dc56782fadf9cd42a39b88624162f4f1de54 (diff)
downloadframeworks_base-e729a9400f3ed2234a95a53aadb3420b76436d63.zip
frameworks_base-e729a9400f3ed2234a95a53aadb3420b76436d63.tar.gz
frameworks_base-e729a9400f3ed2234a95a53aadb3420b76436d63.tar.bz2
Use Object + type in place of specific array
Changed to avoid the explosion of entry points in the JNI layer. Change-Id: I7d6cc565c8853b06560eb891fdd5e8acf05c9779
Diffstat (limited to 'graphics/java/android/renderscript')
-rw-r--r--graphics/java/android/renderscript/Allocation.java24
-rw-r--r--graphics/java/android/renderscript/RenderScript.java68
2 files changed, 25 insertions, 67 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index bb1e743..0cafdd7 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -801,7 +801,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -817,7 +817,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 2, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_16);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -833,7 +833,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_8);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -849,7 +849,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.FLOAT_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -955,7 +955,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length);
+ w, h, data, data.length, Element.DataType.SIGNED_8);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -964,7 +964,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 2);
+ w, h, data, data.length * 2, Element.DataType.SIGNED_16);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -973,7 +973,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 4);
+ w, h, data, data.length * 4, Element.DataType.SIGNED_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -982,7 +982,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 4);
+ w, h, data, data.length * 4, Element.DataType.FLOAT_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -1128,7 +1128,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length);
+ w, h, d, data, data.length, Element.DataType.SIGNED_8);
}
/**
@@ -1139,7 +1139,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 2);
+ w, h, d, data, data.length * 2, Element.DataType.SIGNED_16);
}
/**
@@ -1150,7 +1150,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 4);
+ w, h, d, data, data.length * 4, Element.DataType.SIGNED_32);
}
/**
@@ -1161,7 +1161,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 4);
+ w, h, d, data, data.length * 4, Element.DataType.FLOAT_32);
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 7d4a5c4..da0cfeb 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -386,25 +386,10 @@ public class RenderScript {
}
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, int[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, int[] d, int sizeBytes) {
+ native void rsnAllocationData1D(int con, int id, int off, int mip, int count, Object d, int sizeBytes, int dt);
+ synchronized void nAllocationData1D(int id, int off, int mip, int count, Object d, int sizeBytes, Element.DataType dt) {
validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
- }
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, short[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, short[] d, int sizeBytes) {
- validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
- }
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, byte[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, byte[] d, int sizeBytes) {
- validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
- }
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, float[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, float[] d, int sizeBytes) {
- validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
+ rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes, dt.mID);
}
native void rsnAllocationElementData1D(int con, int id, int xoff, int mip, int compIdx, byte[] d, int sizeBytes);
@@ -433,25 +418,12 @@ public class RenderScript {
srcMip, srcFace);
}
- 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) {
- validate();
- 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) {
- validate();
- 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);
- synchronized void nAllocationData2D(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, Object d, int sizeBytes, int dt);
+ synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face,
+ int w, int h, Object d, int sizeBytes, Element.DataType dt) {
validate();
- 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, 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) {
- validate();
- rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
+ rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes, dt.mID);
}
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) {
@@ -477,27 +449,13 @@ public class RenderScript {
srcAlloc, srcXoff, srcYoff, srcZoff, srcMip);
}
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, byte[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, byte[] d, int sizeBytes) {
+ native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip,
+ int w, int h, int depth, Object d, int sizeBytes, int dt);
+ synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip,
+ int w, int h, int depth, Object d, int sizeBytes, Element.DataType dt) {
validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
+ rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes, dt.mID);
}
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, short[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, short[] d, int sizeBytes) {
- validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
- }
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, int[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, int[] d, int sizeBytes) {
- validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
- }
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, float[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, float[] d, int sizeBytes) {
- validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
- }
-
native void rsnAllocationRead(int con, int id, byte[] d);
synchronized void nAllocationRead(int id, byte[] d) {