Merge "Pass filtering to drawLattice" into sc-dev am: 417f6b1677
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13418275 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I75c5f89ee1c4825b9f1bb1b3b3e9803a0d76cb8c
This commit is contained in:
@@ -700,11 +700,14 @@ void SkiaCanvas::drawNinePatch(Bitmap& bitmap, const Res_png_9patch& chunk, floa
|
|||||||
NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk, colors.get());
|
NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk, colors.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkFilterMode filter = paint && paint->isFilterBitmap() ? SkFilterMode::kLinear
|
||||||
|
: SkFilterMode::kNearest;
|
||||||
|
|
||||||
lattice.fBounds = nullptr;
|
lattice.fBounds = nullptr;
|
||||||
SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
|
SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom);
|
||||||
auto image = bitmap.makeImage();
|
auto image = bitmap.makeImage();
|
||||||
apply_looper(paint, [&](const SkPaint& p) {
|
apply_looper(paint, [&](const SkPaint& p) {
|
||||||
mCanvas->drawImageLattice(image.get(), lattice, dst, &p);
|
mCanvas->drawImageLattice(image.get(), lattice, dst, filter, &p);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,21 +408,24 @@ struct CanvasOp<CanvasOpType::DrawImageLattice> {
|
|||||||
const sk_sp<Bitmap>& bitmap,
|
const sk_sp<Bitmap>& bitmap,
|
||||||
SkRect dst,
|
SkRect dst,
|
||||||
SkCanvas::Lattice lattice,
|
SkCanvas::Lattice lattice,
|
||||||
|
SkFilterMode filter,
|
||||||
SkPaint paint
|
SkPaint paint
|
||||||
): dst(dst),
|
): dst(dst),
|
||||||
lattice(lattice),
|
lattice(lattice),
|
||||||
|
filter(filter),
|
||||||
bitmap(bitmap),
|
bitmap(bitmap),
|
||||||
image(bitmap->makeImage()),
|
image(bitmap->makeImage()),
|
||||||
paint(std::move(paint)) {}
|
paint(std::move(paint)) {}
|
||||||
|
|
||||||
SkRect dst;
|
SkRect dst;
|
||||||
SkCanvas::Lattice lattice;
|
SkCanvas::Lattice lattice;
|
||||||
|
SkFilterMode filter;
|
||||||
const sk_sp<Bitmap> bitmap;
|
const sk_sp<Bitmap> bitmap;
|
||||||
const sk_sp<SkImage> image;
|
const sk_sp<SkImage> image;
|
||||||
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
void draw(SkCanvas* canvas) const {
|
void draw(SkCanvas* canvas) const {
|
||||||
canvas->drawImageLattice(image.get(), lattice, dst, &paint);
|
canvas->drawImageLattice(image.get(), lattice, dst, filter, &paint);
|
||||||
}
|
}
|
||||||
ASSERT_DRAWABLE()
|
ASSERT_DRAWABLE()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -528,6 +528,7 @@ TEST(CanvasOp, simpleDrawImageLattice) {
|
|||||||
bitmap,
|
bitmap,
|
||||||
SkRect::MakeWH(5, 1),
|
SkRect::MakeWH(5, 1),
|
||||||
lattice,
|
lattice,
|
||||||
|
SkFilterMode::kNearest,
|
||||||
SkPaint{}
|
SkPaint{}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user