summaryrefslogtreecommitdiffstats
path: root/src/opengl/util/simple_porter_duff.glsl
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-24 11:34:15 (GMT)
committeraxis <qt-info@nokia.com>2009-04-24 11:34:15 (GMT)
commit8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (patch)
treea17e1a767a89542ab59907462206d7dcf2e504b2 /src/opengl/util/simple_porter_duff.glsl
downloadQt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.zip
Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.gz
Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.bz2
Long live Qt for S60!
Diffstat (limited to 'src/opengl/util/simple_porter_duff.glsl')
-rw-r--r--src/opengl/util/simple_porter_duff.glsl16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/opengl/util/simple_porter_duff.glsl b/src/opengl/util/simple_porter_duff.glsl
new file mode 100644
index 0000000..83aef48
--- /dev/null
+++ b/src/opengl/util/simple_porter_duff.glsl
@@ -0,0 +1,16 @@
+uniform vec2 porterduff_ab;
+uniform vec3 porterduff_xyz;
+
+vec4 composite(vec4 src, vec4 dst)
+{
+ vec4 result;
+
+ result.xyz = porterduff_ab.x * src.xyz * dst.a
+ + porterduff_ab.y * dst.xyz * src.a
+ + porterduff_xyz.y * src.xyz * (1 - dst.a)
+ + porterduff_xyz.z * dst.xyz * (1 - src.a);
+
+ result.a = dot(porterduff_xyz, vec3(src.a * dst.a, src.a * (1 - dst.a), dst.a * (1 - src.a)));
+
+ return result;
+}