Skip to content

Commit 6b4e8c7

Browse files
Derive Default for LineJoin, LineCap. (#129)
1 parent eec0a47 commit 6b4e8c7

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

path/src/stroker.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,17 @@ impl Default for Stroke {
8080
}
8181

8282
/// Draws at the beginning and end of an open path contour.
83-
#[derive(Copy, Clone, PartialEq, Debug)]
83+
#[derive(Copy, Clone, Default, PartialEq, Debug)]
8484
pub enum LineCap {
8585
/// No stroke extension.
86+
#[default]
8687
Butt,
8788
/// Adds circle.
8889
Round,
8990
/// Adds square.
9091
Square,
9192
}
9293

93-
impl Default for LineCap {
94-
fn default() -> Self {
95-
LineCap::Butt
96-
}
97-
}
98-
9994
/// Specifies how corners are drawn when a shape is stroked.
10095
///
10196
/// Join affects the four corners of a stroked rectangle, and the connected segments in a
@@ -108,9 +103,10 @@ impl Default for LineCap {
108103
/// The fill path constructed to describe the stroked path respects the join setting but may
109104
/// not contain the actual join. For instance, a fill path constructed with round joins does
110105
/// not necessarily include circles at each connected segment.
111-
#[derive(Copy, Clone, PartialEq, Debug)]
106+
#[derive(Copy, Clone, Default, PartialEq, Debug)]
112107
pub enum LineJoin {
113108
/// Extends to miter limit, then switches to bevel.
109+
#[default]
114110
Miter,
115111
/// Extends to miter limit, then clips the corner.
116112
MiterClip,
@@ -120,12 +116,6 @@ pub enum LineJoin {
120116
Bevel,
121117
}
122118

123-
impl Default for LineJoin {
124-
fn default() -> Self {
125-
LineJoin::Miter
126-
}
127-
}
128-
129119
const QUAD_RECURSIVE_LIMIT: usize = 3;
130120

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

0 commit comments

Comments
 (0)