aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaj Grönholm <kaj.gronholm@qt.io>2024-08-28 11:48:35 +0300
committerKaj Grönholm <kaj.gronholm@qt.io>2024-09-09 19:34:45 +0300
commitd110993b135963fbab22c27b316c12930a2a4d48 (patch)
treea5a0707963c8d4a31ec361e975eedd70f3878365
parentd4105bae84f07b6454eea04cebab8e59c11471a8 (diff)
Fix MultiEffect shadow coloring
The algorithm for shadow didn't work correctly when the source item was dark and the shadow color wasn't black. Fix the shadow calculation. Task-number: QTBUG-123396 Pick-to: 6.8 Change-Id: Ib038bef4ebdd374cfb3c992c16173f8d8ddc5d13 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/effects/data/shaders/multieffect.frag6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/effects/data/shaders/multieffect.frag b/src/effects/data/shaders/multieffect.frag
index 94099f503f..ad626317e2 100644
--- a/src/effects/data/shaders/multieffect.frag
+++ b/src/effects/data/shaders/multieffect.frag
@@ -101,9 +101,9 @@ void main() {
shadow += texture(blurSrc5, shadowTexCoord).a * shadowBlurWeight2[1];
#endif
shadow *= shadowColor.a;
- float aa = (1.0 - color.a) * (1.0 - shadow);
- color.rgb = mix(shadowColor.rgb * shadow, color.rgb, color.a + aa);
- color.a = 1.0 - aa;
+ float aa = color.a + (1.0 - color.a) * (1.0 - shadow);
+ aa = min(1.0, aa);
+ color = mix(shadowColor, color, aa);
#endif // SHADOW
#if defined(MASK)