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

Commit aed28f85 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check for (and clear) Exceptions thrown by TransferParameters" into main

parents 97d6a53a 3eb6c88b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -583,6 +583,16 @@ jobject GraphicsJNI::getColorSpace(JNIEnv* env, SkColorSpace* decodeColorSpace,
                            transferParams.a, transferParams.b, transferParams.c, transferParams.d,
                            transferParams.e, transferParams.f, transferParams.g);

    // Some transfer functions that are considered valid by Skia are not
    // accepted by android.graphics.
    if (hasException(env)) {
        // Callers (e.g. Bitmap#getColorSpace) are not expected to throw an
        // Exception, so clear it and return null, which is a documented
        // possibility.
        env->ExceptionClear();
        return nullptr;
    }

    jfloatArray xyzArray = env->NewFloatArray(9);
    jfloat xyz[9] = {
            xyzMatrix.vals[0][0],