mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-27 16:57:08 +00:00
Use content mask for quad as well
This commit is contained in:
parent
7643bd61fd
commit
92bda1231e
3 changed files with 6 additions and 8 deletions
|
@ -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,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue