summaryrefslogtreecommitdiffstats
path: root/src/opengl/util/composition_mode_darken.glsl
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /src/opengl/util/composition_mode_darken.glsl
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'src/opengl/util/composition_mode_darken.glsl')
-rw-r--r--src/opengl/util/composition_mode_darken.glsl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/opengl/util/composition_mode_darken.glsl b/src/opengl/util/composition_mode_darken.glsl
new file mode 100644
index 0000000..c1e83fd
--- /dev/null
+++ b/src/opengl/util/composition_mode_darken.glsl
@@ -0,0 +1,9 @@
+// Dca' = min(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa)
+// Da' = Sa + Da - Sa.Da
+vec4 composite(vec4 src, vec4 dst)
+{
+ vec4 result;
+ result.rgb = min(src.rgb * dst.a, dst.rgb * src.a) + src.rgb * (1 - dst.a) + dst.rgb * (1 - src.a);
+ result.a = src.a + dst.a - src.a * dst.a;
+ return result;
+}