|
22 | 22 | #include "fml/logging.h" |
23 | 23 | #include "impeller/typographer/backends/skia/text_frame_skia.h" |
24 | 24 | #include "include/core/SkMatrix.h" |
| 25 | +#include "third_party/skia/src/core/SkTextBlobPriv.h" // nogncheck |
25 | 26 |
|
26 | 27 | namespace txt { |
27 | 28 |
|
@@ -85,6 +86,7 @@ class DisplayListParagraphPainter : public skt::ParagraphPainter { |
85 | 86 |
|
86 | 87 | #ifdef IMPELLER_SUPPORTS_RENDERING |
87 | 88 | if (impeller_enabled_) { |
| 89 | + SkTextBlobRunIterator run(blob.get()); |
88 | 90 | if (ShouldRenderAsPath(dl_paints_[paint_id])) { |
89 | 91 | auto path = skia::textlayout::Paragraph::GetPath(blob.get()); |
90 | 92 | // If there is no path, this is an emoji and should be drawn as is, |
@@ -184,7 +186,14 @@ class DisplayListParagraphPainter : public skt::ParagraphPainter { |
184 | 186 | // running on Impeller for correctness. These filters rely on having the |
185 | 187 | // glyph coverage, whereas regular text is drawn as rectangular texture |
186 | 188 | // samples. |
187 | | - return (paint.getColorSource() && !paint.getColorSource()->asColor()); |
| 189 | + // If the text is stroked and the stroke width is large enough, use path |
| 190 | + // rendering anyway, as the fidelity problems won't be as noticable and |
| 191 | + // rendering will be faster as it avoids software rasterization. A stroke |
| 192 | + // width of four was chosen by eyeballing the point at which the path |
| 193 | + // text looks good enough, with some room for error. |
| 194 | + return (paint.getColorSource() && !paint.getColorSource()->asColor()) || |
| 195 | + (paint.getDrawStyle() == DlDrawStyle::kStroke && |
| 196 | + paint.getStrokeWidth() > 4); |
188 | 197 | } |
189 | 198 |
|
190 | 199 | DlPaint toDlPaint(const DecorationStyle& decor_style, |
|
0 commit comments