diff options
author | Stan Iliev <stani@google.com> | 2018-02-05 18:04:11 -0500 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2018-02-08 23:04:47 +0000 |
commit | 7717e22c85fd2eaba39f1dc38c65fb7f723882f4 (patch) | |
tree | 36a98afb1180490da3e2db3e0e54344ed4a39b86 /libs/hwui/SkiaCanvas.cpp | |
parent | fcd3c57e194ba0fafa2de673f2d4fae6a05ef91e (diff) |
Draw text with a hairline stroke as if it is fill style
Dew to a side effect of HWUI opengl pipeline, the hairline stroke
is not respected, but it is drawn as a fill style. Implement the
same behaviour for skiagl pipeline with SDK API 27 and older.
On SDK released with Android P, the hairline stroke is respected.
Bug: 72494357
Test: Ran duolingo app
Change-Id: I48bdcf3ddec4bf65b5e93e01c5002177c4e3da90
Diffstat (limited to 'libs/hwui/SkiaCanvas.cpp')
-rw-r--r-- | libs/hwui/SkiaCanvas.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp index 9e0d10d07892..2b0b22df7edf 100644 --- a/libs/hwui/SkiaCanvas.cpp +++ b/libs/hwui/SkiaCanvas.cpp @@ -742,6 +742,12 @@ void SkiaCanvas::drawGlyphs(ReadGlyphFunc glyphFunc, int count, const SkPaint& p SkPaint paintCopy(paint); paintCopy.setTextAlign(SkPaint::kLeft_Align); SkASSERT(paintCopy.getTextEncoding() == SkPaint::kGlyphID_TextEncoding); + // Stroke with a hairline is drawn on HW with a fill style for compatibility with Android O and + // older. + if (!mCanvasOwned && sApiLevel <= 27 && paintCopy.getStrokeWidth() <= 0 + && paintCopy.getStyle() == SkPaint::kStroke_Style) { + paintCopy.setStyle(SkPaint::kFill_Style); + } SkRect bounds = SkRect::MakeLTRB(boundsLeft + x, boundsTop + y, boundsRight + x, boundsBottom + y); |