FileDocCategorySizeDatePackage
FieldPacker.javaAPI DocAndroid 5.1 API13636Thu Mar 12 22:22:56 GMT 2015android.support.v8.renderscript

FieldPacker

public class FieldPacker extends Object
Utility class for packing arguments and structures from Android system objects to RenderScript objects. This class is only intended to be used to support the reflected code generated by the RS tool chain. It should not be called directly.

Fields Summary
private FieldPackerThunker
mN
private final byte[]
mData
private int
mPos
private int
mLen
Constructors Summary
public FieldPacker(int len)

        mPos = 0;
        mLen = len;
        mData = new byte[len];
        if (RenderScript.shouldThunk()) {
            mN = new FieldPackerThunker(len);
        }
    
Methods Summary
public voidaddBoolean(boolean v)

        if (RenderScript.shouldThunk()) {
            mN.addBoolean(v);
            return;
        }
        addI8((byte)(v ? 1 : 0));
    
public voidaddF32(float v)

        if (RenderScript.shouldThunk()) {
            mN.addF32(v);
            return;
        }
        addI32(Float.floatToRawIntBits(v));
    
public voidaddF32(Float2 v)

        if (RenderScript.shouldThunk()) {
            mN.addF32(v);
            return;
        }
        addF32(v.x);
        addF32(v.y);
    
public voidaddF32(Float3 v)

        if (RenderScript.shouldThunk()) {
            mN.addF32(v);
            return;
        }
        addF32(v.x);
        addF32(v.y);
        addF32(v.z);
    
public voidaddF32(Float4 v)

        if (RenderScript.shouldThunk()) {
            mN.addF32(v);
            return;
        }
        addF32(v.x);
        addF32(v.y);
        addF32(v.z);
        addF32(v.w);
    
public voidaddF64(double v)

        if (RenderScript.shouldThunk()) {
            mN.addF64(v);
            return;
        }
        addI64(Double.doubleToRawLongBits(v));
    
public voidaddF64(Double2 v)

        if (RenderScript.shouldThunk()) {
            mN.addF64(v);
            return;
        }
        addF64(v.x);
        addF64(v.y);
    
public voidaddF64(Double3 v)

        if (RenderScript.shouldThunk()) {
            mN.addF64(v);
            return;
        }
        addF64(v.x);
        addF64(v.y);
        addF64(v.z);
    
public voidaddF64(Double4 v)

        if (RenderScript.shouldThunk()) {
            mN.addF64(v);
            return;
        }
        addF64(v.x);
        addF64(v.y);
        addF64(v.z);
        addF64(v.w);
    
public voidaddI16(Short2 v)

        if (RenderScript.shouldThunk()) {
            mN.addI16(v);
            return;
        }
        addI16(v.x);
        addI16(v.y);
    
public voidaddI16(Short3 v)

        if (RenderScript.shouldThunk()) {
            mN.addI16(v);
            return;
        }
        addI16(v.x);
        addI16(v.y);
        addI16(v.z);
    
public voidaddI16(Short4 v)

        if (RenderScript.shouldThunk()) {
            mN.addI16(v);
            return;
        }
        addI16(v.x);
        addI16(v.y);
        addI16(v.z);
        addI16(v.w);
    
public voidaddI16(short v)

        if (RenderScript.shouldThunk()) {
            mN.addI16(v);
            return;
        }
        align(2);
        mData[mPos++] = (byte)(v & 0xff);
        mData[mPos++] = (byte)(v >> 8);
    
public voidaddI32(Int2 v)

        if (RenderScript.shouldThunk()) {
            mN.addI32(v);
            return;
        }
        addI32(v.x);
        addI32(v.y);
    
public voidaddI32(Int3 v)

        if (RenderScript.shouldThunk()) {
            mN.addI32(v);
            return;
        }
        addI32(v.x);
        addI32(v.y);
        addI32(v.z);
    
public voidaddI32(Int4 v)

        if (RenderScript.shouldThunk()) {
            mN.addI32(v);
            return;
        }
        addI32(v.x);
        addI32(v.y);
        addI32(v.z);
        addI32(v.w);
    
public voidaddI32(int v)

        if (RenderScript.shouldThunk()) {
            mN.addI32(v);
            return;
        }
        align(4);
        mData[mPos++] = (byte)(v & 0xff);
        mData[mPos++] = (byte)((v >> 8) & 0xff);
        mData[mPos++] = (byte)((v >> 16) & 0xff);
        mData[mPos++] = (byte)((v >> 24) & 0xff);
    
public voidaddI64(Long2 v)

        if (RenderScript.shouldThunk()) {
            mN.addI64(v);
            return;
        }
        addI64(v.x);
        addI64(v.y);
    
public voidaddI64(Long3 v)

        if (RenderScript.shouldThunk()) {
            mN.addI64(v);
            return;
        }
        addI64(v.x);
        addI64(v.y);
        addI64(v.z);
    
public voidaddI64(Long4 v)

        if (RenderScript.shouldThunk()) {
            mN.addI64(v);
            return;
        }
        addI64(v.x);
        addI64(v.y);
        addI64(v.z);
        addI64(v.w);
    
public voidaddI64(long v)

        if (RenderScript.shouldThunk()) {
            mN.addI64(v);
            return;
        }
        align(8);
        mData[mPos++] = (byte)(v & 0xff);
        mData[mPos++] = (byte)((v >> 8) & 0xff);
        mData[mPos++] = (byte)((v >> 16) & 0xff);
        mData[mPos++] = (byte)((v >> 24) & 0xff);
        mData[mPos++] = (byte)((v >> 32) & 0xff);
        mData[mPos++] = (byte)((v >> 40) & 0xff);
        mData[mPos++] = (byte)((v >> 48) & 0xff);
        mData[mPos++] = (byte)((v >> 56) & 0xff);
    
public voidaddI8(Byte2 v)

        if (RenderScript.shouldThunk()) {
            mN.addI8(v);
            return;
        }
        addI8(v.x);
        addI8(v.y);
    
public voidaddI8(Byte3 v)

        if (RenderScript.shouldThunk()) {
            mN.addI8(v);
            return;
        }
        addI8(v.x);
        addI8(v.y);
        addI8(v.z);
    
public voidaddI8(Byte4 v)

        if (RenderScript.shouldThunk()) {
            mN.addI8(v);
            return;
        }
        addI8(v.x);
        addI8(v.y);
        addI8(v.z);
        addI8(v.w);
    
public voidaddI8(byte v)

        if (RenderScript.shouldThunk()) {
            mN.addI8(v);
            return;
        }
        mData[mPos++] = v;
    
public voidaddMatrix(Matrix4f v)

        if (RenderScript.shouldThunk()) {
            mN.addMatrix(v);
            return;
        }
        for (int i=0; i < v.mMat.length; i++) {
            addF32(v.mMat[i]);
        }
    
public voidaddMatrix(Matrix3f v)

        if (RenderScript.shouldThunk()) {
            mN.addMatrix(v);
            return;
        }
        for (int i=0; i < v.mMat.length; i++) {
            addF32(v.mMat[i]);
        }
    
public voidaddMatrix(Matrix2f v)

        if (RenderScript.shouldThunk()) {
            mN.addMatrix(v);
            return;
        }
        for (int i=0; i < v.mMat.length; i++) {
            addF32(v.mMat[i]);
        }
    
public voidaddObj(BaseObj obj)

        if (RenderScript.shouldThunk()) {
            mN.addObj(obj);
            return;
        }
        if (obj != null) {
            addI32(obj.getID(null));
        } else {
            addI32(0);
        }
    
public voidaddU16(int v)

        if (RenderScript.shouldThunk()) {
            mN.addU16(v);
            return;
        }
        if ((v < 0) || (v > 0xffff)) {
            android.util.Log.e("rs", "FieldPacker.addU16( " + v + " )");
            throw new IllegalArgumentException("Saving value out of range for type");
        }
        align(2);
        mData[mPos++] = (byte)(v & 0xff);
        mData[mPos++] = (byte)(v >> 8);
    
public voidaddU16(Int2 v)

        if (RenderScript.shouldThunk()) {
            mN.addU16(v);
            return;
        }
        addU16(v.x);
        addU16(v.y);
    
public voidaddU16(Int3 v)

        if (RenderScript.shouldThunk()) {
            mN.addU16(v);
            return;
        }
        addU16(v.x);
        addU16(v.y);
        addU16(v.z);
    
public voidaddU16(Int4 v)

        if (RenderScript.shouldThunk()) {
            mN.addU16(v);
            return;
        }
        addU16(v.x);
        addU16(v.y);
        addU16(v.z);
        addU16(v.w);
    
public voidaddU32(long v)

        if (RenderScript.shouldThunk()) {
            mN.addU32(v);
            return;
        }
        if ((v < 0) || (v > 0xffffffffL)) {
            android.util.Log.e("rs", "FieldPacker.addU32( " + v + " )");
            throw new IllegalArgumentException("Saving value out of range for type");
        }
        align(4);
        mData[mPos++] = (byte)(v & 0xff);
        mData[mPos++] = (byte)((v >> 8) & 0xff);
        mData[mPos++] = (byte)((v >> 16) & 0xff);
        mData[mPos++] = (byte)((v >> 24) & 0xff);
    
public voidaddU32(Long2 v)

        if (RenderScript.shouldThunk()) {
            mN.addU32(v);
            return;
        }
        addU32(v.x);
        addU32(v.y);
    
public voidaddU32(Long3 v)

        if (RenderScript.shouldThunk()) {
            mN.addU32(v);
            return;
        }
        addU32(v.x);
        addU32(v.y);
        addU32(v.z);
    
public voidaddU32(Long4 v)

        if (RenderScript.shouldThunk()) {
            mN.addU32(v);
            return;
        }
        addU32(v.x);
        addU32(v.y);
        addU32(v.z);
        addU32(v.w);
    
public voidaddU64(long v)

        if (RenderScript.shouldThunk()) {
            mN.addU64(v);
            return;
        }
        if (v < 0) {
            android.util.Log.e("rs", "FieldPacker.addU64( " + v + " )");
            throw new IllegalArgumentException("Saving value out of range for type");
        }
        align(8);
        mData[mPos++] = (byte)(v & 0xff);
        mData[mPos++] = (byte)((v >> 8) & 0xff);
        mData[mPos++] = (byte)((v >> 16) & 0xff);
        mData[mPos++] = (byte)((v >> 24) & 0xff);
        mData[mPos++] = (byte)((v >> 32) & 0xff);
        mData[mPos++] = (byte)((v >> 40) & 0xff);
        mData[mPos++] = (byte)((v >> 48) & 0xff);
        mData[mPos++] = (byte)((v >> 56) & 0xff);
    
public voidaddU64(Long2 v)

        if (RenderScript.shouldThunk()) {
            mN.addU64(v);
            return;
        }
        addU64(v.x);
        addU64(v.y);
    
public voidaddU64(Long3 v)

        if (RenderScript.shouldThunk()) {
            mN.addU64(v);
            return;
        }
        addU64(v.x);
        addU64(v.y);
        addU64(v.z);
    
public voidaddU64(Long4 v)

        if (RenderScript.shouldThunk()) {
            mN.addU64(v);
            return;
        }
        addU64(v.x);
        addU64(v.y);
        addU64(v.z);
        addU64(v.w);
    
public voidaddU8(short v)

        if (RenderScript.shouldThunk()) {
            mN.addU8(v);
            return;
        }
        if ((v < 0) || (v > 0xff)) {
            throw new IllegalArgumentException("Saving value out of range for type");
        }
        mData[mPos++] = (byte)v;
    
public voidaddU8(Short2 v)

        if (RenderScript.shouldThunk()) {
            mN.addU8(v);
            return;
        }
        addU8(v.x);
        addU8(v.y);
    
public voidaddU8(Short3 v)

        if (RenderScript.shouldThunk()) {
            mN.addU8(v);
            return;
        }
        addU8(v.x);
        addU8(v.y);
        addU8(v.z);
    
public voidaddU8(Short4 v)

        if (RenderScript.shouldThunk()) {
            mN.addU8(v);
            return;
        }
        addU8(v.x);
        addU8(v.y);
        addU8(v.z);
        addU8(v.w);
    
public voidalign(int v)

        if (RenderScript.shouldThunk()) {
            mN.align(v);
            return;
        }
        if ((v <= 0) || ((v & (v - 1)) != 0)) {
            throw new RSIllegalArgumentException("argument must be a non-negative non-zero power of 2: " + v);
        }

        while ((mPos & (v - 1)) != 0) {
            mData[mPos++] = 0;
        }
    
public final byte[]getData()

        if (RenderScript.shouldThunk()) {
            return mN.getData();
        }
        return mData;
    
public intgetPos()

        if (RenderScript.shouldThunk()) {
            return mN.getPos();
        }
        return mPos;
    
public voidreset()

        if (RenderScript.shouldThunk()) {
            mN.reset();
            return;
        }
        mPos = 0;
    
public voidreset(int i)

        if (RenderScript.shouldThunk()) {
            mN.reset(i);
            return;
        }
        if ((i < 0) || (i >= mLen)) {
            throw new RSIllegalArgumentException("out of range argument: " + i);
        }
        mPos = i;
    
public voidskip(int i)

        if (RenderScript.shouldThunk()) {
            mN.skip(i);
            return;
        }
        int res = mPos + i;
        if ((res < 0) || (res > mLen)) {
            throw new RSIllegalArgumentException("out of range argument: " + i);
        }
        mPos = res;