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

Commit c65b1d5f authored by Mike Reed's avatar Mike Reed
Browse files

Use newer matrix api

Test: make

Change-Id: I57491a1b352f36b72aba4da2216f7e930b45ed62
parent 2f4a7ff8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -129,8 +129,8 @@ static void nativeSetTransformAndClip(JNIEnv* env, jclass thiz, jlong documentPt

    // 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 reflectOnX = SkMatrix::Scale(1, -1);
    SkMatrix moveUp = SkMatrix::Translate(0, FPDF_GetPageHeight(page));
    SkMatrix coordinateChange = SkMatrix::Concat(moveUp, reflectOnX);

    // Apply the transformation what was created in our coordinates.
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ RENDERTHREAD_TEST(DeferredLayerUpdater, updateLayer) {
    EXPECT_EQ(Matrix4::identity(), layerUpdater->backingLayer()->getTexTransform());

    // push the deferred updates to the layer
    SkMatrix scaledMatrix = SkMatrix::MakeScale(0.5, 0.5);
    SkMatrix scaledMatrix = SkMatrix::Scale(0.5, 0.5);
    SkBitmap bitmap;
    bitmap.allocN32Pixels(16, 16);
    sk_sp<SkImage> layerImage = SkImage::MakeFromBitmap(bitmap);
+5 −5
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ TEST(RenderNodeDrawable, saveLayerClipAndMatrixRestore) {
                ASSERT_EQ(SkRect::MakeLTRB(50, 50, 350, 350), getRecorderClipBounds(recorder));

                recorder.translate(300.0f, 400.0f);
                EXPECT_EQ(SkMatrix::MakeTrans(300.0f, 400.0f), getRecorderMatrix(recorder));
                EXPECT_EQ(SkMatrix::Translate(300.0f, 400.0f), getRecorderMatrix(recorder));

                recorder.restore();
                ASSERT_EQ(SkRect::MakeLTRB(0, 0, 400, 800), getRecorderClipBounds(recorder));
@@ -1120,14 +1120,14 @@ TEST(ReorderBarrierDrawable, testShadowMatrix) {
            if (mFirstDidConcat) {
                // First invocation is EndReorderBarrierDrawable::drawShadow to apply shadow matrix.
                mFirstDidConcat = false;
                EXPECT_EQ(SkMatrix::MakeTrans(CASTER_X + TRANSLATE_X, CASTER_Y + TRANSLATE_Y),
                EXPECT_EQ(SkMatrix::Translate(CASTER_X + TRANSLATE_X, CASTER_Y + TRANSLATE_Y),
                          matrix);
                EXPECT_EQ(SkMatrix::MakeTrans(CASTER_X + TRANSLATE_X, CASTER_Y + TRANSLATE_Y),
                EXPECT_EQ(SkMatrix::Translate(CASTER_X + TRANSLATE_X, CASTER_Y + TRANSLATE_Y),
                          getTotalMatrix());
            } else {
                // Second invocation is preparing the matrix for an elevated RenderNodeDrawable.
                EXPECT_EQ(SkMatrix::MakeTrans(TRANSLATE_X, TRANSLATE_Y), matrix);
                EXPECT_EQ(SkMatrix::MakeTrans(TRANSLATE_X, TRANSLATE_Y), getTotalMatrix());
                EXPECT_EQ(SkMatrix::Translate(TRANSLATE_X, TRANSLATE_Y), matrix);
                EXPECT_EQ(SkMatrix::Translate(TRANSLATE_X, TRANSLATE_Y), getTotalMatrix());
            }
        }

+5 −5
Original line number Diff line number Diff line
@@ -263,10 +263,10 @@ RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaDisplayList, prepareListAndChildren_vdOffscr
    }

    // Another way to be offscreen: a matrix from the draw call.
    for (const SkMatrix translate : { SkMatrix::MakeTrans(width, 0),
                                      SkMatrix::MakeTrans(0, height),
                                      SkMatrix::MakeTrans(-width, 0),
                                      SkMatrix::MakeTrans(0, -height)}) {
    for (const SkMatrix translate : { SkMatrix::Translate(width, 0),
                                      SkMatrix::Translate(0, height),
                                      SkMatrix::Translate(-width, 0),
                                      SkMatrix::Translate(0, -height)}) {
        SkiaDisplayList skiaDL;
        VectorDrawableRoot dirtyVD(new VectorDrawable::Group());
        dirtyVD.mutateProperties()->setBounds(bounds);
@@ -291,7 +291,7 @@ RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaDisplayList, prepareListAndChildren_vdOffscr
        SkiaDisplayList skiaDL;
        VectorDrawableRoot dirtyVD(new VectorDrawable::Group());
        dirtyVD.mutateProperties()->setBounds(bounds);
        SkMatrix translate = SkMatrix::MakeTrans(50, 50);
        SkMatrix translate = SkMatrix::Translate(50, 50);
        skiaDL.appendVD(&dirtyVD, translate);

        ASSERT_TRUE(dirtyVD.isDirty());
+2 −2
Original line number Diff line number Diff line
@@ -111,11 +111,11 @@ TEST(RenderNodeDrawable, renderPropTransform) {
            [](RenderProperties& properties) {
                properties.setLeftTopRightBottom(10, 10, 110, 110);

                SkMatrix staticMatrix = SkMatrix::MakeScale(1.2f, 1.2f);
                SkMatrix staticMatrix = SkMatrix::Scale(1.2f, 1.2f);
                properties.setStaticMatrix(&staticMatrix);

                // ignored, since static overrides animation
                SkMatrix animationMatrix = SkMatrix::MakeTrans(15, 15);
                SkMatrix animationMatrix = SkMatrix::Translate(15, 15);
                properties.setAnimationMatrix(&animationMatrix);

                properties.setTranslationX(10);