summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-08-10 14:55:26 -0700
committerJason Sams <rjsams@android.com>2009-08-10 14:55:26 -0700
commit40a29e8e28772b37ab0f9fe9708ecdcba24abb84 (patch)
treeddc7de5fe342a6bded733e8341b1953a49e0a2d0 /graphics
parentc028d09409c3cd290949974258264903106a3346 (diff)
downloadframeworks_base-40a29e8e28772b37ab0f9fe9708ecdcba24abb84.zip
frameworks_base-40a29e8e28772b37ab0f9fe9708ecdcba24abb84.tar.gz
frameworks_base-40a29e8e28772b37ab0f9fe9708ecdcba24abb84.tar.bz2
Implement basic allocation readback. Add Get height, width to ScriptC_Lib.
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/renderscript/Allocation.java9
-rw-r--r--graphics/java/android/renderscript/RenderScript.java6
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp23
3 files changed, 38 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index ede475f..ca35a40 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -74,6 +74,15 @@ public class Allocation extends BaseObj {
mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d);
}
+ public void readData(int[] d) {
+ mRS.nAllocationRead(mID, d);
+ }
+
+ public void readData(float[] d) {
+ mRS.nAllocationRead(mID, d);
+ }
+
+
public class Adapter1D extends BaseObj {
Adapter1D(int id, RenderScript rs) {
super(rs);
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 9840bbb..0035142 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -100,6 +100,8 @@ public class RenderScript {
native void nAllocationSubData1D(int id, int off, int count, float[] d);
native void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, int[] d);
native void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, float[] d);
+ native void nAllocationRead(int id, int[] d);
+ native void nAllocationRead(int id, float[] d);
native void nTriangleMeshDestroy(int id);
native void nTriangleMeshBegin(int vertex, int index);
@@ -187,6 +189,10 @@ public class RenderScript {
native void nSimpleMeshBindVertex(int id, int alloc, int slot);
native void nSimpleMeshBindIndex(int id, int alloc);
+ native void nAnimationDestroy(int id);
+ native void nAnimationBegin(int attribCount, int keyframeCount);
+ native void nAnimationAdd(float time, float[] attribs);
+ native int nAnimationCreate();
private int mDev;
private int mContext;
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 2c3a6cb..285fdc0 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -389,6 +389,27 @@ nAllocationSubData2D_f(JNIEnv *_env, jobject _this, jint alloc, jint xoff, jint
_env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT);
}
+static void
+nAllocationRead_i(JNIEnv *_env, jobject _this, jint alloc, jintArray data)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ jint len = _env->GetArrayLength(data);
+ LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
+ jint *ptr = _env->GetIntArrayElements(data, NULL);
+ rsAllocationData((RsAllocation)alloc, ptr);
+ _env->ReleaseIntArrayElements(data, ptr, JNI_COMMIT);
+}
+
+static void
+nAllocationRead_f(JNIEnv *_env, jobject _this, jint alloc, jfloatArray data)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ jint len = _env->GetArrayLength(data);
+ LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
+ jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
+ rsAllocationData((RsAllocation)alloc, ptr);
+ _env->ReleaseFloatArrayElements(data, ptr, JNI_COMMIT);
+}
// -----------------------------------
@@ -1197,6 +1218,8 @@ static JNINativeMethod methods[] = {
{"nAllocationSubData1D", "(III[F)V", (void*)nAllocationSubData1D_f },
{"nAllocationSubData2D", "(IIIII[I)V", (void*)nAllocationSubData2D_i },
{"nAllocationSubData2D", "(IIIII[F)V", (void*)nAllocationSubData2D_f },
+{"nAllocationRead", "(I[I)V", (void*)nAllocationRead_i },
+{"nAllocationRead", "(I[F)V", (void*)nAllocationRead_f },
{"nTriangleMeshDestroy", "(I)V", (void*)nTriangleMeshDestroy },
{"nTriangleMeshBegin", "(II)V", (void*)nTriangleMeshBegin },