From 7a721e4e5f8a6dc89035d3dd1e4b8b9b05a8423c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 10 May 2022 20:50:01 +0100 Subject: [PATCH] mformat 1: Drop the size parameter from load_mf1 This was introduced in size handling: Plumb svg size through to OutlineDefn and it seemed a good idea at the time. But when I wrote that I hadn't decided that these entrypoints would be renamed and kept, rather than start to contain conditionals. The mf1 versions can't depend on the size, since in format 1 the SVG's actual size wasn't used. Signed-off-by: Ian Jackson --- src/shapelib.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/shapelib.rs b/src/shapelib.rs index 1b83d1db..a150ed02 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -42,8 +42,7 @@ pub trait OutlineDefn: Debug + Sync + Send + 'static { RectShape { xy: size }.into() } - fn load_mf1(&self, lgi: &GroupData, svg_sz: PosC) - -> Result; + fn load_mf1(&self, group: &GroupData) -> Result; } #[derive(Debug,Clone,Copy)] pub struct ShapeCalculable { } @@ -651,9 +650,9 @@ impl GroupData { } #[throws(LibraryLoadError)] - fn load_shape(&self, svg_sz: PosC) -> (FaceTransform, Outline) { + fn load_shape(&self, _svg_sz: PosC) -> (FaceTransform, Outline) { let xform = FaceTransform::from_group_mf1(self)?; - let outline = self.d.outline.shape().load_mf1(&self, svg_sz)?; + let outline = self.d.outline.shape().load_mf1(&self)?; (xform, outline) } } @@ -730,7 +729,7 @@ impl OutlineDefn for RectDefn { } #[throws(LibraryLoadError)] - fn load_mf1(&self, group: &GroupData, _svg_sz: PosC) -> Outline { + fn load_mf1(&self, group: &GroupData) -> Outline { let size = resolve_square_size(&group.d.size)? .ok_or_else(|| group.mformat.incompat(LLMI::SizeRequired))?; self.load(size) @@ -775,7 +774,7 @@ impl OutlineDefn for CircleDefn { } #[throws(LibraryLoadError)] - fn load_mf1(&self, group: &GroupData, _svg_sz: PosC) -> Outline { + fn load_mf1(&self, group: &GroupData) -> Outline { let diam = match group.d.size.as_slice() { &[c] => c, size => throw!(LLE::WrongNumberOfSizeDimensions -- 2.30.2