diff options
author | Jason Sams <rjsams@android.com> | 2010-10-05 13:35:47 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-05 13:35:47 -0700 |
commit | 68159aabb3d116ec06671fef3900be6fab2de502 (patch) | |
tree | 302488fa2ccb892d81bf165f57b861cf23ec8650 /graphics | |
parent | cd1b8d3665fcab89e28592838cfba1a09bc8202a (diff) | |
parent | 5edc608a0749ed4b7074b5c1243043eb722c3c31 (diff) | |
download | frameworks_base-68159aabb3d116ec06671fef3900be6fab2de502.zip frameworks_base-68159aabb3d116ec06671fef3900be6fab2de502.tar.gz frameworks_base-68159aabb3d116ec06671fef3900be6fab2de502.tar.bz2 |
Merge "Implement allocation resizing."
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 18 | ||||
-rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 9 | ||||
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 16 |
3 files changed, 43 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 985d700..2c076b3 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -182,6 +182,24 @@ public class Allocation extends BaseObj { mRS.nAllocationRead(mID, d); } + public void resize(int dimX) { + if ((mType.getY() > 0)|| (mType.getZ() > 0) || mType.getFaces() || mType.getLOD()) { + throw new IllegalStateException("Resize only support for 1D allocations at this time."); + } + mRS.nAllocationResize1D(mID, dimX); + } + + /* + public void resize(int dimX, int dimY) { + if ((mType.getZ() > 0) || mType.getFaces() || mType.getLOD()) { + throw new IllegalStateException("Resize only support for 2D allocations at this time."); + } + if (mType.getY() == 0) { + throw new IllegalStateException("Resize only support for 2D allocations at this time."); + } + mRS.nAllocationResize2D(mID, dimX, dimY); + } + */ public class Adapter1D extends BaseObj { Adapter1D(int id, RenderScript rs) { diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 3c0b4e5..0088373 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -254,6 +254,15 @@ public class RenderScript { return rsnAllocationGetType(mContext, id); } + native void rsnAllocationResize1D(int con, int id, int dimX); + synchronized void nAllocationResize1D(int id, int dimX) { + rsnAllocationResize1D(mContext, id, dimX); + } + native void rsnAllocationResize2D(int con, int id, int dimX, int dimY); + synchronized void nAllocationResize2D(int id, int dimX, int dimY) { + rsnAllocationResize2D(mContext, id, dimX, dimY); + } + native int rsnFileA3DCreateFromAssetStream(int con, int assetStream); synchronized int nFileA3DCreateFromAssetStream(int assetStream) { return rsnFileA3DCreateFromAssetStream(mContext, assetStream); diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 67a2b63..8f1e93c 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -587,6 +587,20 @@ nAllocationGetType(JNIEnv *_env, jobject _this, RsContext con, jint a) return (jint) rsAllocationGetType(con, (RsAllocation)a); } +static void +nAllocationResize1D(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint dimX) +{ + LOG_API("nAllocationResize1D, con(%p), alloc(%p), sizeX(%i)", con, (RsAllocation)alloc, dimX); + rsAllocationResize1D(con, (RsAllocation)alloc, dimX); +} + +static void +nAllocationResize2D(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint dimX, jint dimY) +{ + LOG_API("nAllocationResize1D, con(%p), alloc(%p), sizeX(%i), sizeY(%i)", con, (RsAllocation)alloc, dimX, dimY); + rsAllocationResize2D(con, (RsAllocation)alloc, dimX, dimY); +} + // ----------------------------------- static int @@ -1252,6 +1266,8 @@ static JNINativeMethod methods[] = { {"rsnAllocationRead", "(II[I)V", (void*)nAllocationRead_i }, {"rsnAllocationRead", "(II[F)V", (void*)nAllocationRead_f }, {"rsnAllocationGetType", "(II)I", (void*)nAllocationGetType}, +{"rsnAllocationResize1D", "(III)V", (void*)nAllocationResize1D }, +{"rsnAllocationResize2D", "(IIII)V", (void*)nAllocationResize2D }, {"rsnAdapter1DBindAllocation", "(III)V", (void*)nAdapter1DBindAllocation }, {"rsnAdapter1DSetConstraint", "(IIII)V", (void*)nAdapter1DSetConstraint }, |