fix(high contrast text): fix solid rectangle background obscuring other text in the same layout pass
This fixes right-aligned or center-aligned text drawing bounds all the
way to the end, even if there's no glyphs there. It also fixes problems
with emojis interspersed with normal text, since the emojis are drawn
in a separate pass with a separate layout, causing their background rect
to be drawn over any normal text drawn before.
The issue was the layout bounds encompasses more than just the glyphs:
it draws from the start of the text bounds all the way to the last
glyph, even if there is empty space between the text start and the first
glyph.
Reverts parts of Ib2ef3925acc89b01c71addb63194d2a403c99cb6, since we no
longer need a layout.
Fix: 322344265
Flag: com.android.graphics.hwui.flags.high_contrast_text_small_text_rect
Test: manual
1. adb shell setenforce 0 && adb shell setprop persist.device_config.aconfig_flags.accessibility.com.android.graphics.hwui.flags.high_contrast_text_small_text_rect true && adb shell stop && adb shell start
2. Settings -> Accessibility -> Display Size and Text
3. Turn on High Contrast Text
Change-Id: Ia4d74bbdc4cb98fc7f5d25d4b9e940d43aff2bb0
diff --git a/libs/hwui/tests/unit/UnderlineTest.cpp b/libs/hwui/tests/unit/UnderlineTest.cpp
index 9911bfa..c70a304 100644
--- a/libs/hwui/tests/unit/UnderlineTest.cpp
+++ b/libs/hwui/tests/unit/UnderlineTest.cpp
@@ -103,9 +103,8 @@
// Create minikin::Layout
std::unique_ptr<Typeface> typeface(makeTypeface());
minikin::Layout layout = doLayout(text, *paint, typeface.get());
- minikin::MinikinRect bounds;
- DrawTextFunctor f(layout, &canvas, *paint, 0, 0, layout.getAdvance(), bounds);
+ DrawTextFunctor f(layout, &canvas, *paint, 0, 0, layout.getAdvance());
MinikinUtils::forFontRun(layout, paint, f);
return f;
}