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

Commit e8800b23 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Handle PDFium API change

It now does not flip coordinate system anymore.

Bug: 72134075
Test: atest CtsPdfTestCases
Change-Id: I4dce299738f24a44478c06fa7179306a4904b5d5
parent 12a9f78d
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -92,20 +92,7 @@ static void nativeRenderPage(JNIEnv* env, jclass thiz, jlong documentPtr, jlong
        renderFlags |= FPDF_PRINTING;
    }

    // PDF's coordinate system origin is left-bottom while in graphics it
    // is the top-left. So, translate the PDF coordinates to ours.
    SkMatrix reflectOnX = SkMatrix::MakeScale(1, -1);
    SkMatrix moveUp = SkMatrix::MakeTrans(0, FPDF_GetPageHeight(page));
    SkMatrix coordinateChange = SkMatrix::Concat(moveUp, reflectOnX);

    // Apply the transformation
    SkMatrix matrix;
    if (transformPtr == 0) {
        matrix = coordinateChange;
    } else {
        matrix = SkMatrix::Concat(*reinterpret_cast<SkMatrix*>(transformPtr), coordinateChange);
    }

    SkMatrix matrix = *reinterpret_cast<SkMatrix*>(transformPtr);
    SkScalar transformValues[6];
    if (!matrix.asAffine(transformValues)) {
        jniThrowException(env, "java/lang/IllegalArgumentException",