Add support for dashed borders to GPUI (#27139)
Features: * Scales dash spacing with border width. * Laying out dashes around rounded corners. * Varying border widths with rounded corners - now uses an ellipse for the inner edge of the border. * When there are no rounded corners, each straight border is laid out separately, so that the dashes to meet at the corners. * All sides of each dash are antialiased.   Release Notes: - N/A --------- Co-authored-by: Michael Sloan <michael@zed.dev> Co-authored-by: Ben <ben@zed.dev>
This commit is contained in:
parent
2fe2028e20
commit
cd1e56d6c7
14 changed files with 869 additions and 159 deletions
|
@ -455,7 +455,7 @@ pub(crate) enum PrimitiveBatch<'a> {
|
|||
#[repr(C)]
|
||||
pub(crate) struct Quad {
|
||||
pub order: DrawOrder,
|
||||
pub pad: u32, // align to 8 bytes
|
||||
pub border_style: BorderStyle,
|
||||
pub bounds: Bounds<ScaledPixels>,
|
||||
pub content_mask: ContentMask<ScaledPixels>,
|
||||
pub background: Background,
|
||||
|
@ -505,6 +505,17 @@ impl From<Shadow> for Primitive {
|
|||
}
|
||||
}
|
||||
|
||||
/// The style of a border.
|
||||
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[repr(C)]
|
||||
pub enum BorderStyle {
|
||||
/// A solid border.
|
||||
#[default]
|
||||
Solid = 0,
|
||||
/// A dashed border.
|
||||
Dashed = 1,
|
||||
}
|
||||
|
||||
/// A data type representing a 2 dimensional transformation that can be applied to an element.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue