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

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

Merge "Pass filtering to drawLattice"

parents 0b0e7b4f 38c1e55f
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -700,11 +700,14 @@ void SkiaCanvas::drawNinePatch(Bitmap& bitmap, const Res_png_9patch& chunk, floa
        NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk, colors.get());
    }

    SkFilterMode filter = paint && paint->isFilterBitmap() ? SkFilterMode::kLinear
                                                           : SkFilterMode::kNearest;

    lattice.fBounds = nullptr;
    SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
    auto image = bitmap.makeImage();
    apply_looper(paint, [&](const SkPaint& p) {
        mCanvas->drawImageLattice(image.get(), lattice, dst, &p);
        mCanvas->drawImageLattice(image.get(), lattice, dst, filter, &p);
    });
}

+4 −1
Original line number Diff line number Diff line
@@ -410,21 +410,24 @@ struct CanvasOp<CanvasOpType::DrawImageLattice> {
        const sk_sp<Bitmap>& bitmap,
        SkRect dst,
        SkCanvas::Lattice lattice,
        SkFilterMode filter,
        SkPaint  paint
    ):  dst(dst),
        lattice(lattice),
        filter(filter),
        bitmap(bitmap),
        image(bitmap->makeImage()),
        paint(std::move(paint)) {}

    SkRect dst;
    SkCanvas::Lattice lattice;
    SkFilterMode filter;
    const sk_sp<Bitmap> bitmap;
    const sk_sp<SkImage> image;

    SkPaint paint;
    void draw(SkCanvas* canvas) const {
        canvas->drawImageLattice(image.get(), lattice, dst, &paint);
        canvas->drawImageLattice(image.get(), lattice, dst, filter, &paint);
    }
    ASSERT_DRAWABLE()
};
+1 −0
Original line number Diff line number Diff line
@@ -528,6 +528,7 @@ TEST(CanvasOp, simpleDrawImageLattice) {
            bitmap,
            SkRect::MakeWH(5, 1),
            lattice,
            SkFilterMode::kNearest,
            SkPaint{}
        }
    );