From 0e540d057c4c57cef5c469e3e94c0eda551b4f46 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Fri, 15 Jan 2021 14:27:02 -0500 Subject: [PATCH] Fix nine-patches to always filter Regression was introduced here: https://android.git.corp.google.com/platform/frameworks/base/+/c2dbc03acc61e3d4303afbbc63c8e7144f617846 Test: make Change-Id: I8153f1d6ecd850953369dd664da88915c3842bb5 --- libs/hwui/pipeline/skia/SkiaRecordingCanvas.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/hwui/pipeline/skia/SkiaRecordingCanvas.cpp b/libs/hwui/pipeline/skia/SkiaRecordingCanvas.cpp index 7faebda8e043f..5dc5429570ee6 100644 --- a/libs/hwui/pipeline/skia/SkiaRecordingCanvas.cpp +++ b/libs/hwui/pipeline/skia/SkiaRecordingCanvas.cpp @@ -304,10 +304,13 @@ void SkiaRecordingCanvas::drawNinePatch(Bitmap& bitmap, const Res_png_9patch& ch SkRect dst = SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom); sk_sp image = bitmap.makeImage(); + // HWUI always draws 9-patches with linear filtering, regardless of the Paint. + const SkFilterMode filter = SkFilterMode::kLinear; + applyLooper(get_looper(paint), filterBitmap(paint), [&](SkScalar x, SkScalar y, const SkPaint* p) { - mRecorder.drawImageLattice(image, lattice, dst.makeOffset(x, y), Paint_to_filter(p), - p, bitmap.palette()); + mRecorder.drawImageLattice(image, lattice, dst.makeOffset(x, y), filter, p, + bitmap.palette()); }); if (!bitmap.isImmutable() && image.get() && !image->unique() && !dst.isEmpty()) {