[librsvg: 2/5] Don't derive Copy for some of the structs for path commands




commit 9f30e9f3ca2054e2a19ea52aeb8b1f849a2b08a1
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Jul 12 13:06:21 2021 -0500

    Don't derive Copy for some of the structs for path commands
    
    Same as the last commit.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/570>

 src/drawing_ctx.rs  | 10 +++++-----
 src/path_builder.rs |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 59f60ddc..6e429857 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -2123,15 +2123,15 @@ impl PathCommand {
         match *self {
             PathCommand::MoveTo(x, y) => cr.move_to(x, y),
             PathCommand::LineTo(x, y) => cr.line_to(x, y),
-            PathCommand::CurveTo(curve) => curve.to_cairo(cr),
-            PathCommand::Arc(arc) => arc.to_cairo(cr),
+            PathCommand::CurveTo(ref curve) => curve.to_cairo(cr),
+            PathCommand::Arc(ref arc) => arc.to_cairo(cr),
             PathCommand::ClosePath => cr.close_path(),
         }
     }
 }
 
 impl EllipticalArc {
-    fn to_cairo(self, cr: &cairo::Context) {
+    fn to_cairo(&self, cr: &cairo::Context) {
         match self.center_parameterization() {
             ArcParameterization::CenterParameters {
                 center,
@@ -2159,8 +2159,8 @@ impl EllipticalArc {
 }
 
 impl CubicBezierCurve {
-    fn to_cairo(self, cr: &cairo::Context) {
-        let Self { pt1, pt2, to } = self;
+    fn to_cairo(&self, cr: &cairo::Context) {
+        let Self { pt1, pt2, to } = *self;
         cr.curve_to(pt1.0, pt1.1, pt2.0, pt2.1, to.0, to.1);
     }
 }
diff --git a/src/path_builder.rs b/src/path_builder.rs
index f96b0dc0..95b1399b 100644
--- a/src/path_builder.rs
+++ b/src/path_builder.rs
@@ -40,7 +40,7 @@ pub enum Sweep {
 }
 
 /// "c" command for paths; describes a cubic Bézier segment.
-#[derive(Debug, Copy, Clone, PartialEq, Default)]
+#[derive(Debug, Clone, PartialEq, Default)]
 pub struct CubicBezierCurve {
     /// The (x, y) coordinates of the first control point.
     pub pt1: (f64, f64),
@@ -98,7 +98,7 @@ pub enum ArcParameterization {
 }
 
 /// "a" command for paths; describes  an elliptical arc in terms of its endpoints.
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct EllipticalArc {
     /// The (x-axis, y-axis) radii for the ellipse.
     pub r: (f64, f64),
@@ -123,7 +123,7 @@ impl EllipticalArc {
     ///
     /// See section B.2.4. Conversion from endpoint to center parameterization
     /// https://www.w3.org/TR/SVG2/implnote.html#ArcConversionEndpointToCenter
-    pub(crate) fn center_parameterization(self) -> ArcParameterization {
+    pub(crate) fn center_parameterization(&self) -> ArcParameterization {
         let Self {
             r: (mut rx, mut ry),
             x_axis_rotation,
@@ -131,7 +131,7 @@ impl EllipticalArc {
             sweep,
             from: (x1, y1),
             to: (x2, y2),
-        } = self;
+        } = *self;
 
         // Ensure radii are non-zero.
         // Otherwise this arc is treated as a line segment joining the end points.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]