Loading graphics/java/android/renderscript/Allocation.java +33 −0 Original line number Diff line number Diff line Loading @@ -40,27 +40,36 @@ public class Allocation extends BaseObj { } public void uploadToTexture(int baseMipLevel) { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToTexture(mID, baseMipLevel); } public void uploadToBufferObject() { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToBufferObject(mID); } public void data(int[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } public void data(short[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } public void data(byte[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } public void data(float[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } private void data1DChecks(int off, int count, int len, int dataSize) { mRS.validate(); if((off < 0) || (count < 1) || ((off + count) > mType.getElementCount())) { throw new IllegalArgumentException("Offset or Count out of bounds."); } Loading Loading @@ -93,30 +102,37 @@ public class Allocation extends BaseObj { public void subData2D(int xoff, int yoff, int w, int h, int[] d) { mRS.validate(); mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4); } public void subData2D(int xoff, int yoff, int w, int h, float[] d) { mRS.validate(); mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4); } public void readData(int[] d) { mRS.validate(); mRS.nAllocationRead(mID, d); } public void readData(float[] d) { mRS.validate(); mRS.nAllocationRead(mID, d); } public void data(Object o) { mRS.validate(); mRS.nAllocationSubDataFromObject(mID, mType, 0, o); } public void read(Object o) { mRS.validate(); mRS.nAllocationSubReadFromObject(mID, mType, 0, o); } public void subData(int offset, Object o) { mRS.validate(); mRS.nAllocationSubDataFromObject(mID, mType, offset, o); } Loading @@ -127,27 +143,33 @@ public class Allocation extends BaseObj { } public void setConstraint(Dimension dim, int value) { mRS.validate(); mRS.nAdapter1DSetConstraint(mID, dim.mID, value); } public void data(int[] d) { mRS.validate(); mRS.nAdapter1DData(mID, d); } public void data(float[] d) { mRS.validate(); mRS.nAdapter1DData(mID, d); } public void subData(int off, int count, int[] d) { mRS.validate(); mRS.nAdapter1DSubData(mID, off, count, d); } public void subData(int off, int count, float[] d) { mRS.validate(); mRS.nAdapter1DSubData(mID, off, count, d); } } public Adapter1D createAdapter1D() { mRS.validate(); int id = mRS.nAdapter1DCreate(); if (id != 0) { mRS.nAdapter1DBindAllocation(id, mID); Loading @@ -163,27 +185,33 @@ public class Allocation extends BaseObj { } public void setConstraint(Dimension dim, int value) { mRS.validate(); mRS.nAdapter2DSetConstraint(mID, dim.mID, value); } public void data(int[] d) { mRS.validate(); mRS.nAdapter2DData(mID, d); } public void data(float[] d) { mRS.validate(); mRS.nAdapter2DData(mID, d); } public void subData(int xoff, int yoff, int w, int h, int[] d) { mRS.validate(); mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d); } public void subData(int xoff, int yoff, int w, int h, float[] d) { mRS.validate(); mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d); } } public Adapter2D createAdapter2D() { mRS.validate(); int id = mRS.nAdapter2DCreate(); if (id != 0) { mRS.nAdapter2DBindAllocation(id, mID); Loading @@ -202,6 +230,7 @@ public class Allocation extends BaseObj { static public Allocation createTyped(RenderScript rs, Type type) throws IllegalArgumentException { rs.validate(); if(type.mID == 0) { throw new IllegalStateException("Bad Type"); } Loading @@ -212,6 +241,7 @@ public class Allocation extends BaseObj { static public Allocation createSized(RenderScript rs, Element e, int count) throws IllegalArgumentException { rs.validate(); Type.Builder b = new Type.Builder(rs, e); b.add(Dimension.X, count); Type t = b.create(); Loading @@ -226,6 +256,7 @@ public class Allocation extends BaseObj { static public Allocation createFromBitmap(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips) throws IllegalArgumentException { rs.validate(); int id = rs.nAllocationCreateFromBitmap(dstFmt.mID, genMips, b); return new Allocation(id, rs, null); } Loading @@ -233,6 +264,7 @@ public class Allocation extends BaseObj { static public Allocation createFromBitmapBoxed(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips) throws IllegalArgumentException { rs.validate(); int id = rs.nAllocationCreateFromBitmapBoxed(dstFmt.mID, genMips, b); return new Allocation(id, rs, null); } Loading @@ -240,6 +272,7 @@ public class Allocation extends BaseObj { static public Allocation createFromBitmapResource(RenderScript rs, Resources res, int id, Element dstFmt, boolean genMips) throws IllegalArgumentException { rs.validate(); InputStream is = null; try { final TypedValue value = new TypedValue(); Loading graphics/java/android/renderscript/Element.java +3 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,7 @@ public class Element extends BaseObj { } public static Element createFromClass(RenderScript rs, Class c) { rs.validate(); Field[] fields = c.getFields(); Builder b = new Builder(rs); Loading Loading @@ -322,6 +323,7 @@ public class Element extends BaseObj { } void init() { mRS.validate(); internalCreate(mRS, this); } Loading Loading @@ -483,6 +485,7 @@ public class Element extends BaseObj { } public Element create() { mRS.validate(); Element e = new Element(mRS, mEntryCount); java.lang.System.arraycopy(mEntries, 0, e.mEntries, 0, mEntryCount); e.init(); Loading graphics/java/android/renderscript/Light.java +3 −0 Original line number Diff line number Diff line Loading @@ -30,10 +30,12 @@ public class Light extends BaseObj { } public void setColor(float r, float g, float b) { mRS.validate(); mRS.nLightSetColor(mID, r, g, b); } public void setPosition(float x, float y, float z) { mRS.validate(); mRS.nLightSetPosition(mID, x, y, z); } Loading Loading @@ -65,6 +67,7 @@ public class Light extends BaseObj { } public Light create() { mRS.validate(); return internalCreate(mRS, this); } } Loading graphics/java/android/renderscript/ProgramFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public class ProgramFragment extends BaseObj { public void bindTexture(Allocation va, int slot) throws IllegalArgumentException { mRS.validate(); if((slot < 0) || (slot >= MAX_SLOT)) { throw new IllegalArgumentException("Slot ID out of range."); } Loading @@ -56,6 +57,7 @@ public class ProgramFragment extends BaseObj { public void bindSampler(Sampler vs, int slot) throws IllegalArgumentException { mRS.validate(); if((slot < 0) || (slot >= MAX_SLOT)) { throw new IllegalArgumentException("Slot ID out of range."); } Loading Loading @@ -149,6 +151,7 @@ public class ProgramFragment extends BaseObj { } public ProgramFragment create() { mRS.validate(); return internalCreate(mRS, this); } } Loading graphics/java/android/renderscript/ProgramRaster.java +3 −0 Original line number Diff line number Diff line Loading @@ -46,11 +46,13 @@ public class ProgramRaster extends BaseObj { } public void setLineWidth(float w) { mRS.validate(); mLineWidth = w; mRS.nProgramRasterSetLineWidth(mID, w); } public void setPointSize(float s) { mRS.validate(); mPointSize = s; mRS.nProgramRasterSetPointSize(mID, s); } Loading Loading @@ -98,6 +100,7 @@ public class ProgramRaster extends BaseObj { } public ProgramRaster create() { mRS.validate(); return internalCreate(mRS, this); } } Loading Loading
graphics/java/android/renderscript/Allocation.java +33 −0 Original line number Diff line number Diff line Loading @@ -40,27 +40,36 @@ public class Allocation extends BaseObj { } public void uploadToTexture(int baseMipLevel) { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToTexture(mID, baseMipLevel); } public void uploadToBufferObject() { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToBufferObject(mID); } public void data(int[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } public void data(short[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } public void data(byte[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } public void data(float[] d) { mRS.validate(); subData1D(0, mType.getElementCount(), d); } private void data1DChecks(int off, int count, int len, int dataSize) { mRS.validate(); if((off < 0) || (count < 1) || ((off + count) > mType.getElementCount())) { throw new IllegalArgumentException("Offset or Count out of bounds."); } Loading Loading @@ -93,30 +102,37 @@ public class Allocation extends BaseObj { public void subData2D(int xoff, int yoff, int w, int h, int[] d) { mRS.validate(); mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4); } public void subData2D(int xoff, int yoff, int w, int h, float[] d) { mRS.validate(); mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4); } public void readData(int[] d) { mRS.validate(); mRS.nAllocationRead(mID, d); } public void readData(float[] d) { mRS.validate(); mRS.nAllocationRead(mID, d); } public void data(Object o) { mRS.validate(); mRS.nAllocationSubDataFromObject(mID, mType, 0, o); } public void read(Object o) { mRS.validate(); mRS.nAllocationSubReadFromObject(mID, mType, 0, o); } public void subData(int offset, Object o) { mRS.validate(); mRS.nAllocationSubDataFromObject(mID, mType, offset, o); } Loading @@ -127,27 +143,33 @@ public class Allocation extends BaseObj { } public void setConstraint(Dimension dim, int value) { mRS.validate(); mRS.nAdapter1DSetConstraint(mID, dim.mID, value); } public void data(int[] d) { mRS.validate(); mRS.nAdapter1DData(mID, d); } public void data(float[] d) { mRS.validate(); mRS.nAdapter1DData(mID, d); } public void subData(int off, int count, int[] d) { mRS.validate(); mRS.nAdapter1DSubData(mID, off, count, d); } public void subData(int off, int count, float[] d) { mRS.validate(); mRS.nAdapter1DSubData(mID, off, count, d); } } public Adapter1D createAdapter1D() { mRS.validate(); int id = mRS.nAdapter1DCreate(); if (id != 0) { mRS.nAdapter1DBindAllocation(id, mID); Loading @@ -163,27 +185,33 @@ public class Allocation extends BaseObj { } public void setConstraint(Dimension dim, int value) { mRS.validate(); mRS.nAdapter2DSetConstraint(mID, dim.mID, value); } public void data(int[] d) { mRS.validate(); mRS.nAdapter2DData(mID, d); } public void data(float[] d) { mRS.validate(); mRS.nAdapter2DData(mID, d); } public void subData(int xoff, int yoff, int w, int h, int[] d) { mRS.validate(); mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d); } public void subData(int xoff, int yoff, int w, int h, float[] d) { mRS.validate(); mRS.nAdapter2DSubData(mID, xoff, yoff, w, h, d); } } public Adapter2D createAdapter2D() { mRS.validate(); int id = mRS.nAdapter2DCreate(); if (id != 0) { mRS.nAdapter2DBindAllocation(id, mID); Loading @@ -202,6 +230,7 @@ public class Allocation extends BaseObj { static public Allocation createTyped(RenderScript rs, Type type) throws IllegalArgumentException { rs.validate(); if(type.mID == 0) { throw new IllegalStateException("Bad Type"); } Loading @@ -212,6 +241,7 @@ public class Allocation extends BaseObj { static public Allocation createSized(RenderScript rs, Element e, int count) throws IllegalArgumentException { rs.validate(); Type.Builder b = new Type.Builder(rs, e); b.add(Dimension.X, count); Type t = b.create(); Loading @@ -226,6 +256,7 @@ public class Allocation extends BaseObj { static public Allocation createFromBitmap(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips) throws IllegalArgumentException { rs.validate(); int id = rs.nAllocationCreateFromBitmap(dstFmt.mID, genMips, b); return new Allocation(id, rs, null); } Loading @@ -233,6 +264,7 @@ public class Allocation extends BaseObj { static public Allocation createFromBitmapBoxed(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips) throws IllegalArgumentException { rs.validate(); int id = rs.nAllocationCreateFromBitmapBoxed(dstFmt.mID, genMips, b); return new Allocation(id, rs, null); } Loading @@ -240,6 +272,7 @@ public class Allocation extends BaseObj { static public Allocation createFromBitmapResource(RenderScript rs, Resources res, int id, Element dstFmt, boolean genMips) throws IllegalArgumentException { rs.validate(); InputStream is = null; try { final TypedValue value = new TypedValue(); Loading
graphics/java/android/renderscript/Element.java +3 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,7 @@ public class Element extends BaseObj { } public static Element createFromClass(RenderScript rs, Class c) { rs.validate(); Field[] fields = c.getFields(); Builder b = new Builder(rs); Loading Loading @@ -322,6 +323,7 @@ public class Element extends BaseObj { } void init() { mRS.validate(); internalCreate(mRS, this); } Loading Loading @@ -483,6 +485,7 @@ public class Element extends BaseObj { } public Element create() { mRS.validate(); Element e = new Element(mRS, mEntryCount); java.lang.System.arraycopy(mEntries, 0, e.mEntries, 0, mEntryCount); e.init(); Loading
graphics/java/android/renderscript/Light.java +3 −0 Original line number Diff line number Diff line Loading @@ -30,10 +30,12 @@ public class Light extends BaseObj { } public void setColor(float r, float g, float b) { mRS.validate(); mRS.nLightSetColor(mID, r, g, b); } public void setPosition(float x, float y, float z) { mRS.validate(); mRS.nLightSetPosition(mID, x, y, z); } Loading Loading @@ -65,6 +67,7 @@ public class Light extends BaseObj { } public Light create() { mRS.validate(); return internalCreate(mRS, this); } } Loading
graphics/java/android/renderscript/ProgramFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public class ProgramFragment extends BaseObj { public void bindTexture(Allocation va, int slot) throws IllegalArgumentException { mRS.validate(); if((slot < 0) || (slot >= MAX_SLOT)) { throw new IllegalArgumentException("Slot ID out of range."); } Loading @@ -56,6 +57,7 @@ public class ProgramFragment extends BaseObj { public void bindSampler(Sampler vs, int slot) throws IllegalArgumentException { mRS.validate(); if((slot < 0) || (slot >= MAX_SLOT)) { throw new IllegalArgumentException("Slot ID out of range."); } Loading Loading @@ -149,6 +151,7 @@ public class ProgramFragment extends BaseObj { } public ProgramFragment create() { mRS.validate(); return internalCreate(mRS, this); } } Loading
graphics/java/android/renderscript/ProgramRaster.java +3 −0 Original line number Diff line number Diff line Loading @@ -46,11 +46,13 @@ public class ProgramRaster extends BaseObj { } public void setLineWidth(float w) { mRS.validate(); mLineWidth = w; mRS.nProgramRasterSetLineWidth(mID, w); } public void setPointSize(float s) { mRS.validate(); mPointSize = s; mRS.nProgramRasterSetPointSize(mID, s); } Loading Loading @@ -98,6 +100,7 @@ public class ProgramRaster extends BaseObj { } public ProgramRaster create() { mRS.validate(); return internalCreate(mRS, this); } } Loading