Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
++
  • Loading branch information
jonahwilliams committed Aug 28, 2024
commit ad893236bf5cf5bfb841681ce9402193543179d4
10 changes: 6 additions & 4 deletions third_party/txt/src/skia/paragraph_skia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class DisplayListParagraphPainter : public skt::ParagraphPainter {
#ifdef IMPELLER_SUPPORTS_RENDERING
if (impeller_enabled_) {
SkTextBlobRunIterator run(blob.get());
if (ShouldRenderAsPath(dl_paints_[paint_id]) ||
ShouldForcePathRendering(run.font(), /*dpr_guess=*/3.0)) {
if (ShouldRenderAsPath(dl_paints_[paint_id])) {
auto path = skia::textlayout::Paragraph::GetPath(blob.get());
// If there is no path, this is an emoji and should be drawn as is,
// ignoring the color source.
Expand Down Expand Up @@ -189,9 +188,12 @@ class DisplayListParagraphPainter : public skt::ParagraphPainter {
// samples.
// If the text is stroked and the stroke width is large enough, use path
// rendering anyway, as the fidelity problems won't be as noticable and
// rendering will be faster as it avoids software rasterization.
// rendering will be faster as it avoids software rasterization. A stroke
// width of four was chosen by eyeballing the point at which the path
// text looks good enough, with some room for error.
return (paint.getColorSource() && !paint.getColorSource()->asColor()) ||
(paint.getDrawStyle() == DlDrawStyle::kStroke && paint.getStrokeWidth() > 16);
(paint.getDrawStyle() == DlDrawStyle::kStroke &&
paint.getStrokeWidth() > 4);
}

DlPaint toDlPaint(const DecorationStyle& decor_style,
Expand Down
2 changes: 1 addition & 1 deletion third_party/txt/tests/paragraph_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ TEST_F(PainterTest, DrawStrokedTextWithLargeWidthImpeller) {
auto style = makeStyle();
DlPaint foreground;
foreground.setDrawStyle(DlDrawStyle::kStroke);
foreground.setStrokeWidth(100);
foreground.setStrokeWidth(10);
style.foreground = foreground;

auto recorder = DlOpRecorder();
Expand Down