@@ -42,7 +42,7 @@ pub enum Cap {
4242}
4343
4444/// Describes the visual style of a stroke.
45- #[ derive( Clone , Debug ) ]
45+ #[ derive( Clone , Debug , PartialEq ) ]
4646#[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
4747#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
4848pub struct Stroke {
@@ -63,11 +63,13 @@ pub struct Stroke {
6363}
6464
6565/// Options for path stroking.
66+ #[ derive( Clone , Copy , Debug , PartialEq ) ]
6667pub struct StrokeOpts {
6768 opt_level : StrokeOptLevel ,
6869}
6970
7071/// Optimization level for computing
72+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
7173pub enum StrokeOptLevel {
7274 /// Adaptively subdivide segments in half.
7375 Subdivide ,
@@ -201,10 +203,10 @@ pub fn stroke(
201203 tolerance : f64 ,
202204) -> BezPath {
203205 if style. dash_pattern . is_empty ( ) {
204- stroke_undashed ( path, style, tolerance, opts)
206+ stroke_undashed ( path, style, tolerance, * opts)
205207 } else {
206208 let dashed = dash ( path. into_iter ( ) , style. dash_offset , & style. dash_pattern ) ;
207- stroke_undashed ( dashed, style, tolerance, opts)
209+ stroke_undashed ( dashed, style, tolerance, * opts)
208210 }
209211}
210212
@@ -213,7 +215,7 @@ fn stroke_undashed(
213215 path : impl IntoIterator < Item = PathEl > ,
214216 style : & Stroke ,
215217 tolerance : f64 ,
216- opts : & StrokeOpts ,
218+ opts : StrokeOpts ,
217219) -> BezPath {
218220 let mut ctx = StrokeCtx {
219221 join_thresh : 2.0 * tolerance / style. width ,
@@ -307,7 +309,7 @@ fn extend_reversed(out: &mut BezPath, elements: &[PathEl]) {
307309 }
308310}
309311
310- fn fit_with_opts ( co : & CubicOffset , tolerance : f64 , opts : & StrokeOpts ) -> BezPath {
312+ fn fit_with_opts ( co : & CubicOffset , tolerance : f64 , opts : StrokeOpts ) -> BezPath {
311313 match opts. opt_level {
312314 StrokeOptLevel :: Subdivide => fit_to_bezpath ( co, tolerance) ,
313315 StrokeOptLevel :: Optimized => fit_to_bezpath_opt ( co, tolerance) ,
@@ -428,7 +430,7 @@ impl StrokeCtx {
428430 self . last_pt = p1;
429431 }
430432
431- fn do_cubic ( & mut self , style : & Stroke , c : CubicBez , tolerance : f64 , opts : & StrokeOpts ) {
433+ fn do_cubic ( & mut self , style : & Stroke , c : CubicBez , tolerance : f64 , opts : StrokeOpts ) {
432434 // First, detect degenerate linear case
433435
434436 // Ordinarily, this is the direction of the chord, but if the chord is very
0 commit comments