From 950f2aa8258e35a8d65e538c3c1da39005f3dd0e Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Wed, 29 Apr 2020 13:46:00 -0400 Subject: Fix setShadowLayer + drawTextOnPath Bug: 140255441 Test: I49c468b0f4cc142e5d6b03f0aee917b3d85153f3 Fix two issues that prevented this combination from working: - make() the SkTextBlob once and reuse it for each iteration of the loop. This is necessary because make() resets the SkTextBlobBuilder, so a second call does nothing. - use the altered SkPaint, passed as a parameter to the lambda, rather than the Paint passed to apply_looper. Incidentally, reference mCanvas directly like the other methods, rather than calling asSkCanvas(), which returns mCanvas. Change-Id: I48ea1232b12df4f5f8afffc20c7dc8e5dc2bb511 --- libs/hwui/SkiaCanvas.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libs/hwui/SkiaCanvas.cpp') diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp index 5790150a3425..941437998838 100644 --- a/libs/hwui/SkiaCanvas.cpp +++ b/libs/hwui/SkiaCanvas.cpp @@ -789,9 +789,11 @@ void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset, xform[i - start].fTx = pos.x() - tan.y() * y - halfWidth * tan.x(); xform[i - start].fTy = pos.y() + tan.x() * y - halfWidth * tan.y(); } - auto* finalCanvas = this->asSkCanvas(); + + sk_sp textBlob(builder.make()); + apply_looper(&paintCopy, [&](const SkPaint& p) { - finalCanvas->drawTextBlob(builder.make(), 0, 0, paintCopy); + mCanvas->drawTextBlob(textBlob, 0, 0, p); }); } -- cgit v1.2.3-59-g8ed1b