diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-03 16:23:07 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-03 16:23:07 -0700 |
commit | 9df76c7c2f94cf3a66a61b28432b7c5d68869255 (patch) | |
tree | 4f5fc5985c51bfccaad47108027055ffc0c83eef /graphics/java/android | |
parent | 8a173f7632c517965f2f482a5a01c514907a076e (diff) | |
parent | bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacb (diff) | |
download | frameworks_base-9df76c7c2f94cf3a66a61b28432b7c5d68869255.zip frameworks_base-9df76c7c2f94cf3a66a61b28432b7c5d68869255.tar.gz frameworks_base-9df76c7c2f94cf3a66a61b28432b7c5d68869255.tar.bz2 |
Merge change 9551
* changes:
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')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 48 | ||||
-rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 24 |
2 files changed, 54 insertions, 18 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 1327328..3b6571a 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 diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index dc87b6a..dd7dd02 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -113,11 +113,20 @@ public class RenderScript { native void nAdapter1DBindAllocation(int ad, int alloc); native void nAdapter1DSetConstraint(int ad, int dim, int value); native void nAdapter1DData(int ad, int[] d); - native void nAdapter1DSubData(int ad, int off, int count, int[] d); native void nAdapter1DData(int ad, float[] d); + native void nAdapter1DSubData(int ad, int off, int count, int[] d); native void nAdapter1DSubData(int ad, int off, int count, float[] d); native int nAdapter1DCreate(); + native void nAdapter2DDestroy(int id); + native void nAdapter2DBindAllocation(int ad, int alloc); + native void nAdapter2DSetConstraint(int ad, int dim, int value); + native void nAdapter2DData(int ad, int[] d); + native void nAdapter2DData(int ad, float[] d); + native void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, int[] d); + native void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, float[] d); + native int nAdapter2DCreate(); + native void nScriptDestroy(int script); native void nScriptBindAllocation(int vtm, int alloc, int slot); native void nScriptCBegin(); @@ -720,19 +729,6 @@ public class RenderScript { nContextBindProgramVertex(pf.mID); } -/* - RsAdapter2D rsAdapter2DCreate (); - void rsAdapter2DBindAllocation (RsAdapter2D adapt, RsAllocation alloc); - void rsAdapter2DDestroy (RsAdapter2D adapter); - void rsAdapter2DSetConstraint (RsAdapter2D adapter, RsDimension dim, uint32_t value); - void rsAdapter2DData (RsAdapter2D adapter, const void * data); - void rsAdapter2DSubData (RsAdapter2D adapter, uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, const void * data); - void rsSamplerBegin (); - void rsSamplerSet (RsSamplerParam p, RsSamplerValue value); - RsSampler rsSamplerCreate (); - void rsSamplerBind (RsSampler sampler, RsAllocation alloc); -*/ - } |