We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5048b97 commit 32c5f46Copy full SHA for 32c5f46
src/widgets/shaders/cliprect.frag
@@ -14,11 +14,12 @@ layout(binding = 2) uniform sampler2D content;
14
15
vec4 overlay(vec4 base, vec4 overlay) {
16
if (overlay.a == 0.0) return base;
17
+ if (base.a == 0.0) return overlay;
18
- float baseMul = 1.0 - overlay.a;
19
- float newAlpha = overlay.a + base.a * baseMul;
20
- vec3 rgb = (overlay.rgb * overlay.a + base.rgb * base.a * baseMul) / newAlpha;
21
- return vec4(rgb, newAlpha);
+ vec3 rgb = overlay.rgb + base.rgb * (1.0 - overlay.a);
+ float a = overlay.a + base.a * (1.0 - overlay.a);
+
22
+ return vec4(rgb, a);
23
}
24
25
void main() {
0 commit comments