src/opengl/util/painter.glsl
author Eckhart Koeppen <eckhart.koppen@nokia.com>
Wed, 21 Apr 2010 11:15:19 +0300
branchRCL_3
changeset 12 25a739ee40f4
parent 0 1918ee327afb
permissions -rw-r--r--
3a438a6e0b41f1ef657ef0e648d352db636204aa

uniform sampler2D dst_texture;
uniform sampler2D mask_texture;
uniform vec2 inv_mask_size;
uniform vec2 inv_dst_size;
uniform vec2 mask_offset;
uniform vec4 mask_channel;

float mask()
{
    return dot(mask_channel, texture2D(mask_texture, (gl_FragCoord.xy + mask_offset) * inv_mask_size));
}

void main()
{
    vec4 dst = texture2D(dst_texture, gl_FragCoord.xy * inv_dst_size);

    // combine clip and coverage channels
    float mask_alpha = mask();

    gl_FragColor = mix(dst, composite(brush(), dst), mask_alpha);
}