Revert "gpui & ui: Use shader for dashed dividers" (#23850)

Reverts zed-industries/zed#23839

getting some reports of linux crashes – will investigate later today

Release Notes:

- N/A
This commit is contained in:
Nate Butler 2025-01-29 14:19:20 -05:00 committed by GitHub
parent 8603a908c1
commit a03b7624f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 106 additions and 210 deletions

View file

@ -797,7 +797,7 @@ float4 over(float4 below, float4 above) {
GradientColor prepare_fill_color(uint tag, uint color_space, Hsla solid,
Hsla color0, Hsla color1) {
GradientColor out;
if (tag == 0 || tag == 2 || tag == 3) {
if (tag == 0 || tag == 2) {
out.solid = hsla_to_rgba(solid);
} else if (tag == 1) {
out.color0 = hsla_to_rgba(color0);
@ -874,10 +874,13 @@ float4 fill_color(Background background,
break;
}
case 2: {
// Slash pattern
// This pattern is full of magic numbers to make it line up perfectly
// when vertically stacked. Make sure you know what you are doing
// if you change this!
float base_pattern_size = bounds.size.height / 5;
float width = base_pattern_size * 0.5;
float slash_spacing = .89; // exact number to make vertical elements line up
float slash_spacing = .89;
float radians = M_PI_F / 4.0;
float2x2 rotation = rotate2d(radians);
float2 relative_position = position - float2(bounds.origin.x, bounds.origin.y);
@ -888,22 +891,6 @@ float4 fill_color(Background background,
color.a *= saturate(0.5 - distance);
break;
}
case 3: {
// Dash pattern
float dash_width = 8.0;
float gap_width = 8.0;
float pattern_width = dash_width + gap_width;
float2 relative_position = position - float2(bounds.origin.x, bounds.origin.y);
// Use a dot product to select x or y based on orientation
float2 orientation_vector = float2(1.0 - background.orientation, background.orientation);
float pattern_position = fmod(dot(relative_position, orientation_vector), pattern_width);
float distance = pattern_position - dash_width;
color = solid_color;
color.a *= step(-distance, 0.0);
break;
}
}
return color;