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

Commit 7754d161 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 1836 into donut

* changes:
  Fix bug 1856713 gl Pointer functions should use Buffer position
parents fa2ab76a 6eedc8d3
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -890,16 +890,10 @@ public class JniCodeEmitter {
                                cname +
                                " = (" +
                                cfunc.getArgType(cIndex).getDeclaration() +
                                ") _env->GetDirectBufferAddress(" +
                                (mUseCPlusPlus ? "" : "_env, ") +
                                ") getDirectBufferPointer(_env, " +
                                cname + "_buf);");
                        String iii = "    ";
                        out.println(iii + indent + "if ( ! " + cname + " ) {");	
                        out.println(iii + iii + indent +
                                (mUseCPlusPlus ? "_env" : "(*_env)") +
                                "->ThrowNew(" +
                                (mUseCPlusPlus ? "" : "_env, ") +
                                "IAEClass, \"Must use a native order direct Buffer\");");
                        out.println(iii + iii + indent + "return;");
                        out.println(iii + indent + "}");
                    } else {
+13 −0
Original line number Diff line number Diff line
@@ -132,6 +132,19 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
					   commit ? 0 : JNI_ABORT);
}

static void *
getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
    if (buf) {
        jint position = _env->GetIntField(buffer, positionID);
        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
        buf += position << elementSizeShift;
    } else {
        _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
    }
    return (void*) buf;
}

static int
getNumCompressedTextureFormats() {
    int numCompressedTextureFormats = 0;
+13 −0
Original line number Diff line number Diff line
@@ -132,6 +132,19 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
					   commit ? 0 : JNI_ABORT);
}

static void *
getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
    if (buf) {
        jint position = _env->GetIntField(buffer, positionID);
        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
        buf += position << elementSizeShift;
    } else {
        _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
    }
    return (void*) buf;
}

static int
getNumCompressedTextureFormats() {
    int numCompressedTextureFormats = 0;