summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Niemelä <marko.a.niemela@nokia.com>2012-03-13 13:34:25 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-14 09:05:07 +0100
commitc0018cc07cbad45e62bac8c8fab6a6469b86f902 (patch)
treebc770593913f2d0c017f2f940826a29b16f10545
parent56abf8b16ff7164b5eabacb686ebc42aa6bdc6d0 (diff)
downloadqtgraphicaleffects-c0018cc07cbad45e62bac8c8fab6a6469b86f902.tar.gz
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>
-rw-r--r--src/effects/internal/FastInnerShadow.qml5
-rw-r--r--src/effects/internal/GaussianInnerShadow.qml4
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;
}
"
}