Skip to content

Commit

Permalink
Derive Default for LineJoin, LineCap. (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Aug 5, 2024
1 parent eec0a47 commit 6b4e8c7
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions path/src/stroker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,17 @@ impl Default for Stroke {
}

/// Draws at the beginning and end of an open path contour.
#[derive(Copy, Clone, PartialEq, Debug)]
#[derive(Copy, Clone, Default, PartialEq, Debug)]
pub enum LineCap {
/// No stroke extension.
#[default]
Butt,
/// Adds circle.
Round,
/// Adds square.
Square,
}

impl Default for LineCap {
fn default() -> Self {
LineCap::Butt
}
}

/// Specifies how corners are drawn when a shape is stroked.
///
/// Join affects the four corners of a stroked rectangle, and the connected segments in a
Expand All @@ -108,9 +103,10 @@ impl Default for LineCap {
/// The fill path constructed to describe the stroked path respects the join setting but may
/// not contain the actual join. For instance, a fill path constructed with round joins does
/// not necessarily include circles at each connected segment.
#[derive(Copy, Clone, PartialEq, Debug)]
#[derive(Copy, Clone, Default, PartialEq, Debug)]
pub enum LineJoin {
/// Extends to miter limit, then switches to bevel.
#[default]
Miter,
/// Extends to miter limit, then clips the corner.
MiterClip,
Expand All @@ -120,12 +116,6 @@ pub enum LineJoin {
Bevel,
}

impl Default for LineJoin {
fn default() -> Self {
LineJoin::Miter
}
}

const QUAD_RECURSIVE_LIMIT: usize = 3;

// quads with extreme widths (e.g. (0,1) (1,6) (0,3) width=5e7) recurse to point of failure
Expand Down

0 comments on commit 6b4e8c7

Please sign in to comment.