aboutsummaryrefslogtreecommitdiff
path: root/alacritty/res/rect.f.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/res/rect.f.glsl')
-rw-r--r--alacritty/res/rect.f.glsl33
1 files changed, 17 insertions, 16 deletions
diff --git a/alacritty/res/rect.f.glsl b/alacritty/res/rect.f.glsl
index d29c8b28..65701da3 100644
--- a/alacritty/res/rect.f.glsl
+++ b/alacritty/res/rect.f.glsl
@@ -16,7 +16,6 @@ flat in color_t color;
#endif
-uniform int rectKind;
uniform float_t cellWidth;
uniform float_t cellHeight;
uniform float_t paddingY;
@@ -27,12 +26,9 @@ uniform float_t underlineThickness;
uniform float_t undercurlPosition;
-#define UNDERCURL 1
-#define DOTTED 2
-#define DASHED 3
-
#define PI 3.1415926538
+#if defined(DRAW_UNDERCURL)
color_t draw_undercurl(float_t x, float_t y) {
// We use `undercurlPosition` as an amplitude, since it's half of the descent
// value.
@@ -55,7 +51,9 @@ color_t draw_undercurl(float_t x, float_t y) {
// The result is an alpha mask on a rect, which leaves only curve opaque.
return vec4(color.rgb, alpha);
}
+#endif
+#if defined(DRAW_DOTTED)
// When the dot size increases we can use AA to make spacing look even and the
// dots rounded.
color_t draw_dotted_aliased(float_t x, float_t y) {
@@ -96,7 +94,9 @@ color_t draw_dotted(float_t x, float_t y) {
return vec4(color.rgb, alpha);
}
+#endif
+#if defined(DRAW_DASHED)
color_t draw_dashed(float_t x) {
// Since dashes of adjacent cells connect with each other our dash length is
// half of the desired total length.
@@ -111,22 +111,23 @@ color_t draw_dashed(float_t x) {
return vec4(color.rgb, alpha);
}
+#endif
void main() {
float_t x = floor(mod(gl_FragCoord.x - paddingX, cellWidth));
float_t y = floor(mod(gl_FragCoord.y - paddingY, cellHeight));
- if (rectKind == UNDERCURL) {
- FRAG_COLOR = draw_undercurl(x, y);
- } else if (rectKind == DOTTED) {
- if (underlineThickness < 2.) {
- FRAG_COLOR = draw_dotted(x, y);
- } else {
- FRAG_COLOR = draw_dotted_aliased(x, y);
- }
- } else if (rectKind == DASHED) {
- FRAG_COLOR = draw_dashed(x);
+#if defined(DRAW_UNDERCURL)
+ FRAG_COLOR = draw_undercurl(x, y);
+#elif defined(DRAW_DOTTED)
+ if (underlineThickness < 2.) {
+ FRAG_COLOR = draw_dotted(x, y);
} else {
- FRAG_COLOR = color;
+ FRAG_COLOR = draw_dotted_aliased(x, y);
}
+#elif defined(DRAW_DASHED)
+ FRAG_COLOR = draw_dashed(x);
+#else
+ FRAG_COLOR = color;
+#endif
}