diff options
| -rw-r--r-- | core/java/android/text/Layout.java | 15 | ||||
| -rw-r--r-- | libs/hwui/aconfig/hwui_flags.aconfig | 7 | ||||
| -rw-r--r-- | libs/hwui/hwui/DrawTextFunctor.h | 16 |
3 files changed, 9 insertions, 29 deletions
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index d53b98c65f9a..3c53506990d1 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -16,7 +16,6 @@ package android.text; -import static com.android.graphics.hwui.flags.Flags.highContrastTextLuminance; import static com.android.text.flags.Flags.FLAG_FIX_LINE_HEIGHT_FOR_LOCALE; import static com.android.text.flags.Flags.FLAG_LETTER_SPACING_JUSTIFICATION; import static com.android.text.flags.Flags.FLAG_USE_BOUNDS_FOR_WIDTH; @@ -670,15 +669,11 @@ public abstract class Layout { // High-contrast text mode // Determine if the text is black-on-white or white-on-black, so we know what blendmode will // give the highest contrast and most realistic text color. - // This equation should match the one in libs/hwui/hwui/DrawTextFunctor.h - if (highContrastTextLuminance()) { - var lab = new double[3]; - ColorUtils.colorToLAB(color, lab); - return lab[0] < 50.0; - } else { - int channelSum = Color.red(color) + Color.green(color) + Color.blue(color); - return channelSum < (128 * 3); - } + // LINT.IfChange(hct_darken) + var lab = new double[3]; + ColorUtils.colorToLAB(color, lab); + return lab[0] < 50.0; + // LINT.ThenChange(/libs/hwui/hwui/DrawTextFunctor.h:hct_darken) } private boolean isJustificationRequired(int lineNum) { diff --git a/libs/hwui/aconfig/hwui_flags.aconfig b/libs/hwui/aconfig/hwui_flags.aconfig index 76ad2acccf89..5e71d3360f39 100644 --- a/libs/hwui/aconfig/hwui_flags.aconfig +++ b/libs/hwui/aconfig/hwui_flags.aconfig @@ -34,13 +34,6 @@ flag { } flag { - name: "high_contrast_text_luminance" - namespace: "accessibility" - description: "Use luminance to determine how to make text more high contrast, instead of RGB heuristic" - bug: "186567103" -} - -flag { name: "high_contrast_text_small_text_rect" namespace: "accessibility" description: "Draw a solid rectangle background behind text instead of a stroke outline" diff --git a/libs/hwui/hwui/DrawTextFunctor.h b/libs/hwui/hwui/DrawTextFunctor.h index e13e136550ca..e05c3d695463 100644 --- a/libs/hwui/hwui/DrawTextFunctor.h +++ b/libs/hwui/hwui/DrawTextFunctor.h @@ -34,9 +34,6 @@ namespace flags = com::android::graphics::hwui::flags; #else namespace flags { -constexpr bool high_contrast_text_luminance() { - return false; -} constexpr bool high_contrast_text_small_text_rect() { return false; } @@ -114,15 +111,10 @@ public: if (CC_UNLIKELY(canvas->isHighContrastText() && paint.getAlpha() != 0)) { // high contrast draw path int color = paint.getColor(); - bool darken; - // This equation should match the one in core/java/android/text/Layout.java - if (flags::high_contrast_text_luminance()) { - uirenderer::Lab lab = uirenderer::sRGBToLab(color); - darken = lab.L <= 50; - } else { - int channelSum = SkColorGetR(color) + SkColorGetG(color) + SkColorGetB(color); - darken = channelSum < (128 * 3); - } + // LINT.IfChange(hct_darken) + uirenderer::Lab lab = uirenderer::sRGBToLab(color); + bool darken = lab.L <= 50; + // LINT.ThenChange(/core/java/android/text/Layout.java:hct_darken) // outline gDrawTextBlobMode = DrawTextBlobMode::HctOutline; |