From 9f708ee7896389e38de3a8fd279d0831c86e9f4c Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Tue, 8 Apr 2025 18:00:30 -0600 Subject: [PATCH] Fix refactoring bug in dashes around rounded corners (#28378) Accidentally introduced in #28341 Release Notes: - N/A --- crates/gpui/src/platform/blade/shaders.wgsl | 10 +++++----- crates/gpui/src/platform/mac/shaders.metal | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/gpui/src/platform/blade/shaders.wgsl b/crates/gpui/src/platform/blade/shaders.wgsl index c28483aeca..0b34a0eea3 100644 --- a/crates/gpui/src/platform/blade/shaders.wgsl +++ b/crates/gpui/src/platform/blade/shaders.wgsl @@ -698,7 +698,7 @@ fn fs_quad(input: QuadVarying) -> @location(0) vec4 { if (is_near_rounded_corner) { let radians = atan2(corner_center_to_point.y, corner_center_to_point.x); - let corner_t = radians * corner_radius * dash_velocity; + let corner_t = radians * corner_radius; if (center_to_point.x >= 0.0) { if (center_to_point.y < 0.0) { @@ -706,12 +706,12 @@ fn fs_quad(input: QuadVarying) -> @location(0) vec4 { // Subtracted because radians is pi/2 to 0 when // going clockwise around the top right corner, // since the y axis has been flipped - t = upto_r - corner_t; + t = upto_r - corner_t * dash_velocity; } else { dash_velocity = corner_dash_velocity_br; // Added because radians is 0 to pi/2 when going // clockwise around the bottom-right corner - t = upto_br + corner_t; + t = upto_br + corner_t * dash_velocity; } } else { if (center_to_point.y >= 0.0) { @@ -719,13 +719,13 @@ fn fs_quad(input: QuadVarying) -> @location(0) vec4 { // Subtracted because radians is pi/2 to 0 when // going clockwise around the bottom-left corner, // since the x axis has been flipped - t = upto_l - corner_t; + t = upto_l - corner_t * dash_velocity; } else { dash_velocity = corner_dash_velocity_tl; // Added because radians is 0 to pi/2 when going // clockwise around the top-left corner, since both // axis were flipped - t = upto_tl + corner_t; + t = upto_tl + corner_t * dash_velocity; } } } else { diff --git a/crates/gpui/src/platform/mac/shaders.metal b/crates/gpui/src/platform/mac/shaders.metal index a7bed19dd8..64ebb1e22b 100644 --- a/crates/gpui/src/platform/mac/shaders.metal +++ b/crates/gpui/src/platform/mac/shaders.metal @@ -298,7 +298,7 @@ fragment float4 quad_fragment(QuadFragmentInput input [[stage_in]], if (is_near_rounded_corner) { float radians = atan2(corner_center_to_point.y, corner_center_to_point.x); - float corner_t = radians * corner_radius * dash_velocity; + float corner_t = radians * corner_radius; if (center_to_point.x >= 0.0) { if (center_to_point.y < 0.0) { @@ -306,12 +306,12 @@ fragment float4 quad_fragment(QuadFragmentInput input [[stage_in]], // Subtracted because radians is pi/2 to 0 when // going clockwise around the top right corner, // since the y axis has been flipped - t = upto_r - corner_t; + t = upto_r - corner_t * dash_velocity; } else { dash_velocity = corner_dash_velocity_br; // Added because radians is 0 to pi/2 when going // clockwise around the bottom-right corner - t = upto_br + corner_t; + t = upto_br + corner_t * dash_velocity; } } else { if (center_to_point.y >= 0.0) { @@ -319,13 +319,13 @@ fragment float4 quad_fragment(QuadFragmentInput input [[stage_in]], // Subtracted because radians is pi/1 to 0 when // going clockwise around the bottom-left corner, // since the x axis has been flipped - t = upto_l - corner_t; + t = upto_l - corner_t * dash_velocity; } else { dash_velocity = corner_dash_velocity_tl; // Added because radians is 0 to pi/2 when going // clockwise around the top-left corner, since both // axis were flipped - t = upto_tl + corner_t; + t = upto_tl + corner_t * dash_velocity; } } } else {