2017-10-09 17:14:24 -04:00
|
|
|
// pathfinder/shaders/gles2/xcaa-mono-resolve.fs.glsl
|
2017-08-24 15:08:58 -04:00
|
|
|
//
|
2017-09-07 17:58:41 -04:00
|
|
|
// Copyright (c) 2017 The Pathfinder Project Developers.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
2017-08-24 15:08:58 -04:00
|
|
|
|
2017-12-30 20:32:51 -05:00
|
|
|
//! Renders a single-channel alpha coverage buffer to an RGB framebuffer.
|
|
|
|
|
2017-08-24 15:08:58 -04:00
|
|
|
precision mediump float;
|
|
|
|
|
2018-01-04 21:07:14 -05:00
|
|
|
/// The background color of the monochrome path.
|
2017-08-24 15:08:58 -04:00
|
|
|
uniform vec4 uBGColor;
|
2018-01-04 21:07:14 -05:00
|
|
|
/// The foreground color of the monochrome path.
|
2017-08-24 15:08:58 -04:00
|
|
|
uniform vec4 uFGColor;
|
2018-01-04 21:07:14 -05:00
|
|
|
/// The alpha coverage texture.
|
2017-08-24 15:08:58 -04:00
|
|
|
uniform sampler2D uAAAlpha;
|
|
|
|
|
|
|
|
varying vec2 vTexCoord;
|
|
|
|
|
|
|
|
void main() {
|
2018-03-09 12:20:27 -05:00
|
|
|
float alpha = abs(texture2D(uAAAlpha, vTexCoord).r);
|
2017-10-26 23:15:41 -04:00
|
|
|
gl_FragColor = mix(uBGColor, uFGColor, alpha);
|
2017-08-24 15:08:58 -04:00
|
|
|
}
|