diff options
author | Jason Sams <rjsams@android.com> | 2010-10-26 16:16:17 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-26 16:16:17 -0700 |
commit | 64eb351cff16db2aeaf2c279fbcce9c6a80d0047 (patch) | |
tree | a6f84a9e3da23cc1786664396b28161f4378557b /graphics | |
parent | 6bdf5c39d80efaba9142b87d27a3d09457edd967 (diff) | |
parent | 31a7e42f4baa059352f0db119de38428e655eab2 (diff) | |
download | frameworks_base-64eb351cff16db2aeaf2c279fbcce9c6a80d0047.zip frameworks_base-64eb351cff16db2aeaf2c279fbcce9c6a80d0047.tar.gz frameworks_base-64eb351cff16db2aeaf2c279fbcce9c6a80d0047.tar.bz2 |
Merge "Begin adding async allocation creation."
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 6 | ||||
-rw-r--r-- | graphics/java/android/renderscript/Script.java | 17 | ||||
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 6 |
3 files changed, 9 insertions, 20 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 6c08ce5..f8ad5cc 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -194,11 +194,15 @@ public class Allocation extends BaseObj { mRS.nAllocationRead(mID, d); } - public void resize(int dimX) { + public synchronized 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); + + int typeID = mRS.nAllocationGetType(mID); + mType = new Type(typeID, mRS); + mType.updateFromNative(); } /* diff --git a/graphics/java/android/renderscript/Script.java b/graphics/java/android/renderscript/Script.java index 53a33e4..430789a 100644 --- a/graphics/java/android/renderscript/Script.java +++ b/graphics/java/android/renderscript/Script.java @@ -112,12 +112,10 @@ public class Script extends BaseObj { public static class FieldBase { protected Element mElement; - protected Type mType; protected Allocation mAllocation; protected void init(RenderScript rs, int dimx) { mAllocation = Allocation.createSized(rs, mElement, dimx); - mType = mAllocation.getType(); } protected FieldBase() { @@ -128,7 +126,7 @@ public class Script extends BaseObj { } public Type getType() { - return mType; + return mAllocation.getType(); } public Allocation getAllocation() { @@ -138,19 +136,6 @@ public class Script extends BaseObj { //@Override public void updateAllocation() { } - - - // - /* - public class ScriptField_UserField - extends android.renderscript.Script.FieldBase { - - protected - - } - - */ - } } diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 16d5bfe..dd108c0 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -377,7 +377,7 @@ static jint nAllocationCreateTyped(JNIEnv *_env, jobject _this, RsContext con, jint e) { LOG_API("nAllocationCreateTyped, con(%p), e(%p)", con, (RsElement)e); - return (jint) rsAllocationCreateTyped(con, (RsElement)e); + return (jint) rsaAllocationCreateTyped(con, (RsElement)e); } static void @@ -428,7 +428,7 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, RsContext con, jint dst const int w = bitmap.width(); const int h = bitmap.height(); const void* ptr = bitmap.getPixels(); - jint id = (jint)rsAllocationCreateFromBitmap(con, w, h, (RsElement)dstFmt, e, genMips, ptr); + jint id = (jint)rsaAllocationCreateFromBitmap(con, w, h, (RsElement)dstFmt, e, genMips, ptr); bitmap.unlockPixels(); return id; } @@ -488,7 +488,7 @@ nAllocationCreateFromAssetStream(JNIEnv *_env, jobject _this, RsContext con, jin const int w = bitmap.width(); const int h = bitmap.height(); const void* ptr = bitmap.getPixels(); - jint id = (jint)rsAllocationCreateFromBitmap(con, w, h, (RsElement)dstFmt, e, genMips, ptr); + jint id = (jint)rsaAllocationCreateFromBitmap(con, w, h, (RsElement)dstFmt, e, genMips, ptr); bitmap.unlockPixels(); return id; } |