Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use content mask for quad as well
Antonio Scandurra92bda1231ef3
diff --git a/crates/gpui3/src/platform/mac/shaders.metal b/crates/gpui3/src/platform/mac/shaders.metalindex b4614bef4d5..f71f849438f 100644--- a/crates/gpui3/src/platform/mac/shaders.metal+++ b/crates/gpui3/src/platform/mac/shaders.metal@@ -30,7 +30,8 @@ vertex QuadVertexOutput quad_vertex(uint unit_vertex_id [[vertex_id]],float2 unit_vertex = unit_vertices[unit_vertex_id];Quad quad = quads[quad_id];float4 device_position = to_device_position(unit_vertex, quad.bounds,- quad.clip_bounds, viewport_size);+ quad.content_mask.bounds,+ viewport_size);float4 background_color = hsla_to_rgba(quad.background);float4 border_color = hsla_to_rgba(quad.border_color);return QuadVertexOutput{device_position, background_color, border_color,diff --git a/crates/gpui3/src/scene.rs b/crates/gpui3/src/scene.rsindex 742317da42c..8d34d0d3cfd 100644--- a/crates/gpui3/src/scene.rs+++ b/crates/gpui3/src/scene.rs@@ -191,13 +191,12 @@ pub(crate) enum PrimitiveBatch<'a> {},}-#[derive(Debug, Copy, Clone, Eq, PartialEq)]+#[derive(Debug, Clone, Eq, PartialEq)]#[repr(C)]pub struct Quad {pub order: u32,pub bounds: Bounds<ScaledPixels>,- pub clip_bounds: Bounds<ScaledPixels>,- pub clip_corner_radii: Corners<ScaledPixels>,+ pub content_mask: ScaledContentMask,pub background: Hsla,pub border_color: Hsla,pub corner_radii: Corners<ScaledPixels>,diff --git a/crates/gpui3/src/style.rs b/crates/gpui3/src/style.rsindex 1f874807488..19c9c31b48b 100644--- a/crates/gpui3/src/style.rs+++ b/crates/gpui3/src/style.rs@@ -236,15 +236,13 @@ impl Style {let background_color = self.fill.as_ref().and_then(Fill::color);if background_color.is_some() || self.is_border_visible() {let layer_id = cx.current_layer_id();+ let content_mask = cx.content_mask();cx.scene().insert(layer_id,Quad {order,bounds: bounds.scale(scale),- clip_bounds: bounds.scale(scale), // todo!- clip_corner_radii: self- .corner_radii- .map(|length| length.to_pixels(rem_size).scale(scale)),+ content_mask: content_mask.scale(scale),background: background_color.unwrap_or_default(),border_color: self.border_color.unwrap_or_default(),corner_radii: self