diff options
Diffstat (limited to 'graphics/java/android')
6 files changed, 18 insertions, 34 deletions
diff --git a/graphics/java/android/graphics/ColorMatrixColorFilter.java b/graphics/java/android/graphics/ColorMatrixColorFilter.java index 245c615..4f32342 100644 --- a/graphics/java/android/graphics/ColorMatrixColorFilter.java +++ b/graphics/java/android/graphics/ColorMatrixColorFilter.java @@ -27,7 +27,7 @@ public class ColorMatrixColorFilter extends ColorFilter { public ColorMatrixColorFilter(ColorMatrix matrix) { final float[] colorMatrix = matrix.getArray(); native_instance = nativeColorMatrixFilter(colorMatrix); - nativeColorFilter = nColorMatrixFilter(colorMatrix); + nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix); } /** @@ -42,9 +42,9 @@ public class ColorMatrixColorFilter extends ColorFilter { throw new ArrayIndexOutOfBoundsException(); } native_instance = nativeColorMatrixFilter(array); - nativeColorFilter = nColorMatrixFilter(array); + nativeColorFilter = nColorMatrixFilter(native_instance, array); } private static native int nativeColorMatrixFilter(float[] array); - private static native int nColorMatrixFilter(float[] array); + private static native int nColorMatrixFilter(int nativeFilter, float[] array); } diff --git a/graphics/java/android/graphics/LightingColorFilter.java b/graphics/java/android/graphics/LightingColorFilter.java index 715ce86..c621de6 100644 --- a/graphics/java/android/graphics/LightingColorFilter.java +++ b/graphics/java/android/graphics/LightingColorFilter.java @@ -30,9 +30,9 @@ public class LightingColorFilter extends ColorFilter { */ public LightingColorFilter(int mul, int add) { native_instance = native_CreateLightingFilter(mul, add); - nativeColorFilter = nCreateLightingFilter(mul, add); + nativeColorFilter = nCreateLightingFilter(native_instance, mul, add); } private static native int native_CreateLightingFilter(int mul, int add); - private static native int nCreateLightingFilter(int mul, int add); + private static native int nCreateLightingFilter(int nativeFilter, int mul, int add); } diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java index b02dab1..ecc7c24 100644 --- a/graphics/java/android/graphics/PorterDuffColorFilter.java +++ b/graphics/java/android/graphics/PorterDuffColorFilter.java @@ -26,9 +26,10 @@ public class PorterDuffColorFilter extends ColorFilter { */ public PorterDuffColorFilter(int srcColor, PorterDuff.Mode mode) { native_instance = native_CreatePorterDuffFilter(srcColor, mode.nativeInt); - nativeColorFilter = nCreatePorterDuffFilter(srcColor, mode.nativeInt); + nativeColorFilter = nCreatePorterDuffFilter(native_instance, srcColor, mode.nativeInt); } private static native int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode); - private static native int nCreatePorterDuffFilter(int srcColor, int porterDuffMode); + private static native int nCreatePorterDuffFilter(int nativeFilter, int srcColor, + int porterDuffMode); } 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/FileA3D.java b/graphics/java/android/renderscript/FileA3D.java index 7548878..fc74fc4 100644 --- a/graphics/java/android/renderscript/FileA3D.java +++ b/graphics/java/android/renderscript/FileA3D.java @@ -141,9 +141,11 @@ public class FileA3D extends BaseObj { } IndexEntry[] mFileEntries; + InputStream mInputStream; - FileA3D(int id, RenderScript rs) { + FileA3D(int id, RenderScript rs, InputStream stream) { super(id, rs); + mInputStream = stream; } private void initEntries() { @@ -193,20 +195,12 @@ public class FileA3D extends BaseObj { if(fileId == 0) { throw new IllegalStateException("Load failed."); } - FileA3D fa3d = new FileA3D(fileId, rs); + FileA3D fa3d = new FileA3D(fileId, rs, is); fa3d.initEntries(); return fa3d; } catch (Exception e) { // Ignore - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - // Ignore - } - } } return null; 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 - - } - - */ - } } |