Implement the jni bindings for Adapter2D. Fix a refcount bug in the native adapter implementation. Use adapters in Film to border the mipmaps.

This commit is contained in:
Jason Sams
2009-08-03 16:03:08 -07:00
parent b8c5a84e7c
commit bd1c3ad0cd
5 changed files with 171 additions and 25 deletions

View File

@@ -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