0
|
1 |
uniform sampler2D dst_texture;
|
|
2 |
uniform sampler2D mask_texture;
|
|
3 |
uniform vec2 inv_mask_size;
|
|
4 |
uniform vec2 inv_dst_size;
|
|
5 |
uniform vec2 mask_offset;
|
|
6 |
uniform vec4 mask_channel;
|
|
7 |
|
|
8 |
float mask()
|
|
9 |
{
|
|
10 |
return dot(mask_channel, texture2D(mask_texture, (gl_FragCoord.xy + mask_offset) * inv_mask_size));
|
|
11 |
}
|
|
12 |
|
|
13 |
void main()
|
|
14 |
{
|
|
15 |
vec4 dst = texture2D(dst_texture, gl_FragCoord.xy * inv_dst_size);
|
|
16 |
|
|
17 |
// combine clip and coverage channels
|
|
18 |
float mask_alpha = mask();
|
|
19 |
|
|
20 |
gl_FragColor = mix(dst, composite(brush(), dst), mask_alpha);
|
|
21 |
}
|