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

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

Merge "Use newer matrix api"

parents 9d56fb91 c65b1d5f
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line 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
    // PDF's coordinate system origin is left-bottom while in graphics it
    // is the top-left. So, translate the PDF coordinates to ours.
    // is the top-left. So, translate the PDF coordinates to ours.
    SkMatrix reflectOnX = SkMatrix::MakeScale(1, -1);
    SkMatrix reflectOnX = SkMatrix::Scale(1, -1);
    SkMatrix moveUp = SkMatrix::MakeTrans(0, FPDF_GetPageHeight(page));
    SkMatrix moveUp = SkMatrix::Translate(0, FPDF_GetPageHeight(page));
    SkMatrix coordinateChange = SkMatrix::Concat(moveUp, reflectOnX);
    SkMatrix coordinateChange = SkMatrix::Concat(moveUp, reflectOnX);


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


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


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


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


        ASSERT_TRUE(dirtyVD.isDirty());
        ASSERT_TRUE(dirtyVD.isDirty());
+2 −2
Original line number Original line Diff line number Diff line
@@ -111,11 +111,11 @@ TEST(RenderNodeDrawable, renderPropTransform) {
            [](RenderProperties& properties) {
            [](RenderProperties& properties) {
                properties.setLeftTopRightBottom(10, 10, 110, 110);
                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);
                properties.setStaticMatrix(&staticMatrix);


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


                properties.setTranslationX(10);
                properties.setTranslationX(10);