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

Commit 3fb9b227 authored by Candice's avatar Candice
Browse files

Invert everything for text if it is ForceInvert

Invert the colors of DrawTextBlob when we perform a full color force
inversion within an app.to guarantee the contrasts between ops.

Bug: 406341247
Test: manually check the behaviors on Starbucks and Phone settings
Flag: android.view.accessibility.force_invert_color
Change-Id: I4a42b718e752fdf7d687e4e20ec639eb6db4fa07
parent b5f9f849
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1227,6 +1227,13 @@ template<>
constexpr color_transform_fn colorTransformForOp<DrawTextBlob>() {
    return [](const void *opRaw, ColorTransform transform) {
        const DrawTextBlob *op = reinterpret_cast<const DrawTextBlob*>(opRaw);
        if (transform == ColorTransform::Invert) {
            // Invert the colors no matter the usages of the ops to guarantee the contrast between
            // ops when we perform a full force invert
            transformPaint(transform, const_cast<SkPaint*>(&(op->paint)));
            return;
        }

        switch (op->drawTextBlobMode) {
        case DrawTextBlobMode::HctOutline:
            const_cast<SkPaint&>(op->paint).setColor(SK_ColorBLACK);