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

Commit ba9d5851 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Handle premultiplication correctly for ColorMatrixColorFilters" into lmp-dev

parents 63b328bd 73821c8d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -327,8 +327,10 @@ const char* gFS_Main_ApplyColorOp[3] = {
        // None
        "",
        // Matrix
        "    fragColor.rgb /= (fragColor.a + 0.0019);\n" // un-premultiply
        "    fragColor *= colorMatrix;\n"
        "    fragColor += colorMatrixVector;\n",
        "    fragColor += colorMatrixVector;\n"
        "    fragColor.rgb *= (fragColor.a + 0.0019);\n", // re-premultiply
        // PorterDuff
        "    fragColor = blendColors(colorBlend, fragColor);\n"
};
+2 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ public:
    // TODO: move to a method on android:Paint
    static inline bool paintWillNotDraw(const SkPaint& paint) {
        return paint.getAlpha() == 0
                && !paint.getColorFilter()
                && getXfermode(paint.getXfermode()) != SkXfermode::kClear_Mode;
    }

@@ -77,6 +78,7 @@ public:
    static inline bool paintWillNotDrawText(const SkPaint& paint) {
        return paint.getAlpha() == 0
                && paint.getLooper() == NULL
                && !paint.getColorFilter()
                && getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
    }
// ----------------------------------------------------------------------------