Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2e69a91 authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "More API updates."

parents 7a49e60e d4b23b54
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -378,12 +378,12 @@ public class Allocation extends BaseObj {
        mBitmapOptions.inScaled = false;
    }

    static public Allocation createTyped(RenderScript rs, Type type, int usage) {
    static public Allocation createTyped(RenderScript rs, Type type, MipmapControl mc, int usage) {
        rs.validate();
        if (type.getID() == 0) {
            throw new RSInvalidStateException("Bad Type");
        }
        int id = rs.nAllocationCreateTyped(type.getID(), usage);
        int id = rs.nAllocationCreateTyped(type.getID(), mc.mID, usage);
        if (id == 0) {
            throw new RSRuntimeException("Allocation creation failed.");
        }
@@ -391,7 +391,7 @@ public class Allocation extends BaseObj {
    }

    static public Allocation createTyped(RenderScript rs, Type type) {
        return createTyped(rs, type, USAGE_ALL);
        return createTyped(rs, type, MipmapControl.MIPMAP_NONE, USAGE_SCRIPT);
    }

    static public Allocation createSized(RenderScript rs, Element e,
@@ -401,7 +401,7 @@ public class Allocation extends BaseObj {
        b.setX(count);
        Type t = b.create();

        int id = rs.nAllocationCreateTyped(t.getID(), usage);
        int id = rs.nAllocationCreateTyped(t.getID(), MipmapControl.MIPMAP_NONE.mID, usage);
        if (id == 0) {
            throw new RSRuntimeException("Allocation creation failed.");
        }
@@ -409,7 +409,7 @@ public class Allocation extends BaseObj {
    }

    static public Allocation createSized(RenderScript rs, Element e, int count) {
        return createSized(rs, e, count, USAGE_ALL);
        return createSized(rs, e, count, USAGE_SCRIPT);
    }

    static private Element elementFromBitmap(RenderScript rs, Bitmap b) {
@@ -458,7 +458,7 @@ public class Allocation extends BaseObj {
        if (genMips) {
            mc = MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE;
        }
        return createFromBitmap(rs, b, mc, USAGE_ALL);
        return createFromBitmap(rs, b, mc, USAGE_GRAPHICS_TEXTURE);
    }

    static public Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b,
@@ -507,7 +507,7 @@ public class Allocation extends BaseObj {
        if (genMips) {
            mc = MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE;
        }
        return createCubemapFromBitmap(rs, b, mc, layout, USAGE_ALL);
        return createCubemapFromBitmap(rs, b, mc, layout, USAGE_GRAPHICS_TEXTURE);
    }

    static public Allocation createFromBitmapResource(RenderScript rs,
@@ -532,7 +532,7 @@ public class Allocation extends BaseObj {
        if (genMips) {
            mc = MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE;
        }
        return createFromBitmapResource(rs, res, id, mc, USAGE_ALL);
        return createFromBitmapResource(rs, res, id, mc, USAGE_GRAPHICS_TEXTURE);
    }

    static public Allocation createFromString(RenderScript rs,
+2 −6
Original line number Diff line number Diff line
@@ -77,18 +77,14 @@ public class Mesh extends BaseObj {

        for(int i = 0; i < vtxCount; i ++) {
            if(vtxIDs[i] != 0) {
                mVertexBuffers[i] = new Allocation(vtxIDs[i], mRS, null,
                                                   Allocation.USAGE_GRAPHICS_VERTEX |
                                                   Allocation.USAGE_SCRIPT);
                mVertexBuffers[i] = new Allocation(vtxIDs[i], mRS, null, Allocation.USAGE_SCRIPT);
                mVertexBuffers[i].updateFromNative();
            }
        }

        for(int i = 0; i < idxCount; i ++) {
            if(idxIDs[i] != 0) {
                mIndexBuffers[i] = new Allocation(idxIDs[i], mRS, null,
                                                  Allocation.USAGE_GRAPHICS_VERTEX |
                                                  Allocation.USAGE_SCRIPT);
                mIndexBuffers[i] = new Allocation(idxIDs[i], mRS, null, Allocation.USAGE_SCRIPT);
                mIndexBuffers[i].updateFromNative();
            }
            mPrimitives[i] = Primitive.values()[primitives[i]];
+3 −3
Original line number Diff line number Diff line
@@ -191,9 +191,9 @@ public class RenderScript {
        rsnTypeGetNativeData(mContext, id, typeData);
    }

    native int  rsnAllocationCreateTyped(int con, int type, int usage);
    synchronized int nAllocationCreateTyped(int type, int usage) {
        return rsnAllocationCreateTyped(mContext, type, usage);
    native int  rsnAllocationCreateTyped(int con, int type, int mip, int usage);
    synchronized int nAllocationCreateTyped(int type, int mip, int usage) {
        return rsnAllocationCreateTyped(mContext, type, mip, usage);
    }
    native int  rsnAllocationCreateFromBitmap(int con, int type, int mip, Bitmap bmp, int usage);
    synchronized int nAllocationCreateFromBitmap(int type, int mip, Bitmap bmp, int usage) {
+5 −5
Original line number Diff line number Diff line
@@ -377,8 +377,8 @@ nTypeGetNativeData(JNIEnv *_env, jobject _this, RsContext con, jint id, jintArra
static jint
nAllocationCreateTyped(JNIEnv *_env, jobject _this, RsContext con, jint type, jint mips, jint usage)
{
    LOG_API("nAllocationCreateTyped, con(%p), type(%p), mip(%i), usage(%i)", con, (RsElement)type, mip, usage);
    return (jint) rsaAllocationCreateTyped(con, (RsType)type, (RsAllocationMipmapGenerationControl)mips, (uint32_t)usage);
    LOG_API("nAllocationCreateTyped, con(%p), type(%p), mip(%i), usage(%i)", con, (RsElement)type, mips, usage);
    return (jint) rsaAllocationCreateTyped(con, (RsType)type, (RsAllocationMipmapControl)mips, (uint32_t)usage);
}

static void
@@ -411,7 +411,7 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, RsContext con, jint typ

    bitmap.lockPixels();
    const void* ptr = bitmap.getPixels();
    jint id = (jint)rsaAllocationCreateFromBitmap(con, (RsType)type, (RsAllocationMipmapGenerationControl)mip, ptr, usage);
    jint id = (jint)rsaAllocationCreateFromBitmap(con, (RsType)type, (RsAllocationMipmapControl)mip, ptr, usage);
    bitmap.unlockPixels();
    return id;
}
@@ -425,7 +425,7 @@ nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, RsContext con, jint

    bitmap.lockPixels();
    const void* ptr = bitmap.getPixels();
    jint id = (jint)rsaAllocationCubeCreateFromBitmap(con, (RsType)type, (RsAllocationMipmapGenerationControl)mip, ptr, usage);
    jint id = (jint)rsaAllocationCubeCreateFromBitmap(con, (RsType)type, (RsAllocationMipmapControl)mip, ptr, usage);
    bitmap.unlockPixels();
    return id;
}
@@ -1245,7 +1245,7 @@ static JNINativeMethod methods[] = {
{"rsnTypeCreate",                    "(IIIIIZZ)I",                            (void*)nTypeCreate },
{"rsnTypeGetNativeData",             "(II[I)V",                               (void*)nTypeGetNativeData },

{"rsnAllocationCreateTyped",         "(III)I",                                (void*)nAllocationCreateTyped },
{"rsnAllocationCreateTyped",         "(IIII)I",                               (void*)nAllocationCreateTyped },
{"rsnAllocationCreateFromBitmap",    "(IIILandroid/graphics/Bitmap;I)I",      (void*)nAllocationCreateFromBitmap },
{"rsnAllocationCubeCreateFromBitmap","(IIILandroid/graphics/Bitmap;I)I",      (void*)nAllocationCubeCreateFromBitmap },

+7 −7
Original line number Diff line number Diff line
@@ -105,10 +105,10 @@ enum RsAllocationUsageType {
    RS_ALLOCATION_USAGE_ALL = 0x000F
};

enum RsAllocationMipmapGenerationControl {
    RS_MIPMAP_NONE = 0,
    RS_MIPMAP_FULL = 1,
    RS_MIPMAP_TEXTURE_ONLY = 2
enum RsAllocationMipmapControl {
    RS_ALLOCATION_MIPMAP_NONE = 0,
    RS_ALLOCATION_MIPMAP_FULL = 1,
    RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
};

enum RsDataType {
@@ -345,13 +345,13 @@ void rsaElementGetSubElements(RsContext, RsElement, uint32_t *ids, const char **
RsType rsaTypeCreate(RsContext, RsElement, uint32_t dimX, uint32_t dimY,
                     uint32_t dimZ, bool mips, bool faces);
RsAllocation rsaAllocationCreateTyped(RsContext rsc, RsType vtype,
                                      RsAllocationMipmapGenerationControl mips,
                                      RsAllocationMipmapControl mips,
                                      uint32_t usages);
RsAllocation rsaAllocationCreateFromBitmap(RsContext con, RsType vtype,
                                           RsAllocationMipmapGenerationControl mips,
                                           RsAllocationMipmapControl mips,
                                           const void *data, uint32_t usages);
RsAllocation rsaAllocationCubeCreateFromBitmap(RsContext con, RsType vtype,
                                               RsAllocationMipmapGenerationControl mips,
                                               RsAllocationMipmapControl mips,
                                               const void *data, uint32_t usages);

#ifndef NO_RS_FUNCS
Loading