Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b3c6ab0 authored by Jean Chen's avatar Jean Chen Committed by Android (Google) Code Review
Browse files

Merge "Remove enabled flag high_contrast_text_luminance" into main

parents e302462c 38270bd4
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -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()) {
        // LINT.IfChange(hct_darken)
        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.ThenChange(/libs/hwui/hwui/DrawTextFunctor.h:hct_darken)
    }

    private boolean isJustificationRequired(int lineNum) {
+0 −7
Original line number Diff line number Diff line
@@ -33,13 +33,6 @@ flag {
  bug: "234181960"
}

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"
+4 −12
Original line number Diff line number Diff line
@@ -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()) {
            // LINT.IfChange(hct_darken)
            uirenderer::Lab lab = uirenderer::sRGBToLab(color);
                darken = lab.L <= 50;
            } else {
                int channelSum = SkColorGetR(color) + SkColorGetG(color) + SkColorGetB(color);
                darken = channelSum < (128 * 3);
            }
            bool darken = lab.L <= 50;
            // LINT.ThenChange(/core/java/android/text/Layout.java:hct_darken)

            // outline
            gDrawTextBlobMode = DrawTextBlobMode::HctOutline;