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

Commit 9ab41030 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 110bc6a5: am 2eaefe19: Simplify handling of opaque layers in shader generation

* commit '110bc6a5':
  Simplify handling of opaque layers in shader generation
parents 0c92ef2b 110bc6a5
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -140,30 +140,18 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) {
    } else {
        fs << "gl_FragColor = color;";
    }
    if (needs.isOpaque()) {
        fs << "gl_FragColor.a = 1.0;";
    }
    if (needs.hasPlaneAlpha()) {
        // modulate the alpha value with planeAlpha
        if (needs.isPremultiplied()) {
            // ... and the color too if we're premultiplied
            if (needs.isOpaque()) {
                // ... we're opaque, only premultiply the color component
                fs << "gl_FragColor.rgb *= alphaPlane;"
                   << "gl_FragColor.a = alphaPlane;";
            } else {
            fs << "gl_FragColor *= alphaPlane;";
            }
        } else {
            // not premultiplied
            if (needs.isOpaque()) {
                fs << "gl_FragColor.a = alphaPlane;";
        } else {
            fs << "gl_FragColor.a *= alphaPlane;";
        }
    }
    } else {
        if (needs.isOpaque()) {
            fs << "gl_FragColor.a = 1.0;";
        }
    }
    fs << dedent << "}";
    return fs.getString();
}