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

Commit dac6ed0b authored by Stephen Hines's avatar Stephen Hines
Browse files

Add rsnScriptForEachClipped() implementation with no param array.

JNI doesn't let us pass down a NULL parameter array (from the usrData part
of our reflection). In this case, we simply clone our existing function, but
remove the offending array parameter.

Change-Id: Ib1d6e202f2a55ba8922eec3da5a93d8daa882250
parent 7d9cf2b7
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -519,6 +519,8 @@ public class RenderScript {
    native void rsnScriptForEach(int con, int id, int slot, int ain, int aout);
    native void rsnScriptForEachClipped(int con, int id, int slot, int ain, int aout, byte[] params,
                                        int xstart, int xend, int ystart, int yend, int zstart, int zend);
    native void rsnScriptForEachClipped(int con, int id, int slot, int ain, int aout,
                                        int xstart, int xend, int ystart, int yend, int zstart, int zend);
    synchronized void nScriptForEach(int id, int slot, int ain, int aout, byte[] params) {
        validate();
        if (params == null) {
@@ -531,8 +533,12 @@ public class RenderScript {
    synchronized void nScriptForEachClipped(int id, int slot, int ain, int aout, byte[] params,
                                            int xstart, int xend, int ystart, int yend, int zstart, int zend) {
        validate();
        if (params == null) {
            rsnScriptForEachClipped(mContext, id, slot, ain, aout, xstart, xend, ystart, yend, zstart, zend);
        } else {
            rsnScriptForEachClipped(mContext, id, slot, ain, aout, params, xstart, xend, ystart, yend, zstart, zend);
        }
    }

    native void rsnScriptInvokeV(int con, int id, int slot, byte[] params);
    synchronized void nScriptInvokeV(int id, int slot, byte[] params) {
+23 −2
Original line number Diff line number Diff line
@@ -1054,6 +1054,26 @@ nScriptForEachV(JNIEnv *_env, jobject _this, RsContext con,

static void
nScriptForEachClipped(JNIEnv *_env, jobject _this, RsContext con,
                      jint script, jint slot, jint ain, jint aout,
                      jint xstart, jint xend,
                      jint ystart, jint yend, jint zstart, jint zend)
{
    LOG_API("nScriptForEachClipped, con(%p), s(%p), slot(%i)", con, (void *)script, slot);
    RsScriptCall sc;
    sc.xStart = xstart;
    sc.xEnd = xend;
    sc.yStart = ystart;
    sc.yEnd = yend;
    sc.zStart = zstart;
    sc.zEnd = zend;
    sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
    sc.arrayStart = 0;
    sc.arrayEnd = 0;
    rsScriptForEach(con, (RsScript)script, slot, (RsAllocation)ain, (RsAllocation)aout, NULL, 0, &sc, sizeof(sc));
}

static void
nScriptForEachClippedV(JNIEnv *_env, jobject _this, RsContext con,
                       jint script, jint slot, jint ain, jint aout,
                       jbyteArray params, jint xstart, jint xend,
                       jint ystart, jint yend, jint zstart, jint zend)
@@ -1536,7 +1556,8 @@ static JNINativeMethod methods[] = {
{"rsnScriptInvokeV",                 "(III[B)V",                              (void*)nScriptInvokeV },
{"rsnScriptForEach",                 "(IIIII)V",                              (void*)nScriptForEach },
{"rsnScriptForEach",                 "(IIIII[B)V",                            (void*)nScriptForEachV },
{"rsnScriptForEachClipped",          "(IIIII[BIIIIII)V",                      (void*)nScriptForEachClipped },
{"rsnScriptForEachClipped",          "(IIIIIIIIIII)V",                        (void*)nScriptForEachClipped },
{"rsnScriptForEachClipped",          "(IIIII[BIIIIII)V",                      (void*)nScriptForEachClippedV },
{"rsnScriptSetVarI",                 "(IIII)V",                               (void*)nScriptSetVarI },
{"rsnScriptSetVarJ",                 "(IIIJ)V",                               (void*)nScriptSetVarJ },
{"rsnScriptSetVarF",                 "(IIIF)V",                               (void*)nScriptSetVarF },