diff options
author | Jason Sams <rjsams@android.com> | 2009-08-03 16:03:08 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-08-03 16:03:08 -0700 |
commit | bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacb (patch) | |
tree | fa3ac33695695699563507abb0dad5691058596e /graphics/java/android/renderscript/Allocation.java | |
parent | b8c5a84e7c23746a3fc26013e0880d3d95ca6588 (diff) |
Implement the jni bindings for Adapter2D. Fix a refcount bug in the native adapter implementation. Use adapters in Film to border the mipmaps.
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 13273280fb9c..3b6571aaf043 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -90,14 +90,14 @@ public class Allocation extends BaseObj { mRS.nAdapter1DData(mID, d); } - public void subData(int off, int count, int[] d) { - mRS.nAdapter1DSubData(mID, off, count, d); - } - public void data(float[] d) { mRS.nAdapter1DData(mID, d); } + public void subData(int off, int count, int[] d) { + mRS.nAdapter1DSubData(mID, off, count, d); + } + public void subData(int off, int count, float[] d) { mRS.nAdapter1DSubData(mID, off, count, d); } @@ -112,6 +112,46 @@ public class Allocation extends BaseObj { } + public class Adapter2D extends BaseObj { + Adapter2D(int id, RenderScript rs) { + super(rs); + mID = id; + } + + public void destroy() { + mRS.nAdapter2DDestroy(mID); + mID = 0; + } + + public void setConstraint(Dimension dim, int value) { + mRS.nAdapter2DSetConstraint(mID, dim.mID, value); + } + + public void data(int[] d) { + mRS.nAdapter2DData(mID, d); + } + + public void data(float[] d) { + mRS.nAdapter2DData(mID, d); + } + + public void subData(int xoff, int yoff, int w, int h, int[] d) { + mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d); + } + + public void subData(int xoff, int yoff, int w, int h, float[] d) { + mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d); + } + } + + public Adapter2D createAdapter2D() { + int id = mRS.nAdapter2DCreate(); + if (id != 0) { + mRS.nAdapter2DBindAllocation(id, mID); + } + return new Adapter2D(id, mRS); + } + // creation |