diff options
author | Jason Sams <rjsams@android.com> | 2010-10-05 13:32:49 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-10-05 13:32:49 -0700 |
commit | 5edc608a0749ed4b7074b5c1243043eb722c3c31 (patch) | |
tree | 6a9bb5e4d9a93cac9360b3c87647403818eebd10 /graphics/java | |
parent | 2a2a38db16f3aff962ca17bac18d5c5379b25172 (diff) | |
download | frameworks_base-5edc608a0749ed4b7074b5c1243043eb722c3c31.zip frameworks_base-5edc608a0749ed4b7074b5c1243043eb722c3c31.tar.gz frameworks_base-5edc608a0749ed4b7074b5c1243043eb722c3c31.tar.bz2 |
Implement allocation resizing.
Change-Id: Ie38d42419d595cec730a8721cc1321c5edb6b4d6
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 18 | ||||
-rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 9 |
2 files changed, 27 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); |