From ed130cdacce66ed2ae4f9e44bb4ae894beefceca Mon Sep 17 00:00:00 2001 From: Will McKinnon Date: Wed, 26 Oct 2022 01:19:02 -0400 Subject: [PATCH] style: cleaned up rounded corner shader --- include/sway/desktop/shaders.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/sway/desktop/shaders.h b/include/sway/desktop/shaders.h index a30d45e0..4ff9ca42 100644 --- a/include/sway/desktop/shaders.h +++ b/include/sway/desktop/shaders.h @@ -123,24 +123,20 @@ const GLchar corner_fragment_src[] = "}\n" "\n" "void main() {\n" -" gl_FragColor = v_color;\n" " vec2 center = gl_FragCoord.xy - position - half_size;\n" " float distance = roundedBoxSDF(center, half_size - half_thickness, radius + half_thickness);\n" " float smoothedAlphaOuter = 1.0 - smoothstep(-1.0, 1.0, distance - half_thickness);\n" // Create an inner circle that isn't as anti-aliased as the outer ring " float smoothedAlphaInner = 1.0 - smoothstep(-1.0, 0.5, distance + half_thickness);\n" -" gl_FragColor = mix(vec4(0), gl_FragColor, smoothedAlphaOuter - smoothedAlphaInner);\n" +" gl_FragColor = mix(vec4(0), v_color, smoothedAlphaOuter - smoothedAlphaInner);\n" "\n" " if (is_top_left && (center.y > 0.0 || center.x > 0.0)) {\n" " discard;\n" -" }\n" -" else if (is_top_right && (center.y > 0.0 || center.x < 0.0)) {\n" +" } else if (is_top_right && (center.y > 0.0 || center.x < 0.0)) {\n" " discard;\n" -" }\n" -" else if (is_bottom_left && (center.y < 0.0 || center.x > 0.0)) {\n" +" } else if (is_bottom_left && (center.y < 0.0 || center.x > 0.0)) {\n" " discard;\n" -" }\n" -" else if (is_bottom_right && (center.y < 0.0 || center.x < 0.0)) {\n" +" } else if (is_bottom_right && (center.y < 0.0 || center.x < 0.0)) {\n" " discard;\n" " }\n" "}\n";