mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Fix blending of quad's border with background
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
3f6960bd34
commit
dedd5d63fb
1 changed files with 4 additions and 12 deletions
|
@ -66,21 +66,13 @@ float4 quad_sdf(QuadFragmentInput input) {
|
|||
border_width = vertical_border;
|
||||
}
|
||||
|
||||
float4 color;
|
||||
if (border_width == 0.) {
|
||||
color = input.background_color;
|
||||
} else {
|
||||
float4 border_color = float4(mix(float3(input.background_color), float3(input.border_color), input.border_color.a), 1.);
|
||||
float4 color = input.background_color * float4(1., 1., 1., saturate(0.5 - distance));
|
||||
if (border_width != 0.) {
|
||||
float inset_distance = distance + border_width;
|
||||
color = mix(
|
||||
border_color,
|
||||
input.background_color,
|
||||
saturate(0.5 - inset_distance)
|
||||
);
|
||||
color = mix(input.border_color, color, saturate(0.5 - inset_distance));
|
||||
}
|
||||
|
||||
float4 coverage = float4(1., 1., 1., saturate(0.5 - distance));
|
||||
return coverage * color;
|
||||
return color;
|
||||
}
|
||||
|
||||
vertex QuadFragmentInput quad_vertex(
|
||||
|
|
Loading…
Reference in a new issue