shaders: Use half-pixels for the outline
This commit is contained in:
parent
fc7bbd7814
commit
2c9857fdfc
2 changed files with 3 additions and 3 deletions
|
|
@ -208,7 +208,7 @@ impl IndicatorShader {
|
||||||
alpha: f32,
|
alpha: f32,
|
||||||
active_window_hint: [f32; 3],
|
active_window_hint: [f32; 3],
|
||||||
) -> PixelShaderElement {
|
) -> PixelShaderElement {
|
||||||
let t = (thickness as i32) / 2;
|
let t = thickness as i32;
|
||||||
element_geo.loc -= (t, t).into();
|
element_geo.loc -= (t, t).into();
|
||||||
element_geo.size += (t * 2, t * 2).into();
|
element_geo.size += (t * 2, t * 2).into();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ void main() {
|
||||||
vec4 mix_color;
|
vec4 mix_color;
|
||||||
|
|
||||||
float distance = rounded_box(location - center, (size / 2.0) - (thickness / 2.0), radius);
|
float distance = rounded_box(location - center, (size / 2.0) - (thickness / 2.0), radius);
|
||||||
float smoothedAlpha = 1.0 - smoothstep(0.0, 1.0, abs(distance) - (thickness / 2.0));
|
float smoothedAlpha = 1.0 - smoothstep(-0.5, 0.5, abs(distance) - (thickness / 2.0));
|
||||||
|
|
||||||
mix_color = mix(vec4(0.0, 0.0, 0.0, 0.0), vec4(color, alpha), smoothedAlpha);
|
mix_color = mix(vec4(0.0, 0.0, 0.0, 0.0), vec4(color, alpha), smoothedAlpha);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue