diff options
author | Marko Niemelä <marko.a.niemela@nokia.com> | 2012-03-13 13:34:25 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-14 09:05:07 +0100 |
commit | c0018cc07cbad45e62bac8c8fab6a6469b86f902 (patch) | |
tree | bc770593913f2d0c017f2f940826a29b16f10545 /src | |
parent | 56abf8b16ff7164b5eabacb686ebc42aa6bdc6d0 (diff) | |
download | qtgraphicaleffects-c0018cc07cbad45e62bac8c8fab6a6469b86f902.tar.gz qtgraphicaleffects-c0018cc07cbad45e62bac8c8fab6a6469b86f902.tar.bz2 qtgraphicaleffects-c0018cc07cbad45e62bac8c8fab6a6469b86f902.zip |
Fixed InnerShadow color mixing.
Shadow color was incorrectly mixed with transparent black which
produced dirty-looking result for instance when shadow color was
set to white.
Both versions (fast and high quality) of InnerShadow are fixed.
Change-Id: I0af4b97c247c0890fb7d31767945a538fa4967d0
Reviewed-by: Kim Gronholm <kim.1.gronholm@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/effects/internal/FastInnerShadow.qml | 5 | ||||
-rw-r--r-- | src/effects/internal/GaussianInnerShadow.qml | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/effects/internal/FastInnerShadow.qml b/src/effects/internal/FastInnerShadow.qml index 760e069..04a45ce 100644 --- a/src/effects/internal/FastInnerShadow.qml +++ b/src/effects/internal/FastInnerShadow.qml @@ -404,10 +404,9 @@ Item { shadowColor += texture2D(source3, qt_TexCoord0) * weight3; shadowColor += texture2D(source4, qt_TexCoord0) * weight4; shadowColor += texture2D(source5, qt_TexCoord0) * weight5; - shadowColor = mix(vec4(0), color, linearstep(0.0, spread, shadowColor.a)); - lowp vec4 originalColor = texture2D(original, qt_TexCoord0); - gl_FragColor = vec4(mix(originalColor.rgb, shadowColor.rgb, shadowColor.a * qt_Opacity), originalColor.a) * originalColor.a * qt_Opacity; + shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a)); + gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity; } " } diff --git a/src/effects/internal/GaussianInnerShadow.qml b/src/effects/internal/GaussianInnerShadow.qml index a340062..b4b7190 100644 --- a/src/effects/internal/GaussianInnerShadow.qml +++ b/src/effects/internal/GaussianInnerShadow.qml @@ -156,8 +156,8 @@ Item { void main(void) { lowp vec4 originalColor = texture2D(original, qt_TexCoord0); lowp vec4 shadowColor = texture2D(shadow, qt_TexCoord0); - shadowColor = mix(vec4(0), color, linearstep(0.0, spread, shadowColor.a)); - gl_FragColor = vec4(mix(originalColor.rgb, shadowColor.rgb, shadowColor.a * qt_Opacity), originalColor.a) * originalColor.a * qt_Opacity; + shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a)); + gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity; } " } |