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
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index 5790150..9414379 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -789,9 +789,11 @@
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<SkTextBlob> textBlob(builder.make());
+
apply_looper(&paintCopy, [&](const SkPaint& p) {
- finalCanvas->drawTextBlob(builder.make(), 0, 0, paintCopy);
+ mCanvas->drawTextBlob(textBlob, 0, 0, p);
});
}