2017-10-30 16:34:55 -04:00
|
|
|
// pathfinder/shaders/gles2/xcaa-multi-edge-mask-line.vs.glsl
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
precision highp float;
|
|
|
|
|
|
|
|
varying vec4 vEndpoints;
|
|
|
|
varying float vWinding;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
// Unpack.
|
2017-11-21 18:51:27 -05:00
|
|
|
vec2 pixelCenter = gl_FragCoord.xy;
|
2017-10-30 16:34:55 -04:00
|
|
|
vec2 p0 = vEndpoints.xy, p1 = vEndpoints.zw;
|
|
|
|
|
2017-11-21 18:51:27 -05:00
|
|
|
// Clip to left and right pixel boundaries.
|
|
|
|
vec2 dP = p1 - p0;
|
|
|
|
vec4 p0DPX = clipLineToPixelColumn(p0, dP, pixelCenter.x);
|
|
|
|
|
2017-10-30 16:34:55 -04:00
|
|
|
// Discard if not edge.
|
2017-11-21 18:51:27 -05:00
|
|
|
if (!isPartiallyCovered(p0DPX.xy, p0DPX.zw - p0DPX.xy, pixelCenter.y))
|
2017-10-30 16:34:55 -04:00
|
|
|
discard;
|
|
|
|
gl_FragColor = vec4(1.0);
|
|
|
|
}
|