chiark / gitweb /
mformat 1: Drop the size parameter from load_mf1
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 10 May 2022 19:50:01 +0000 (20:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 May 2022 23:19:17 +0000 (00:19 +0100)
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 <ijackson@chiark.greenend.org.uk>
src/shapelib.rs

index 1b83d1db580eb6765ca2c3604c958eb2a43515fa..a150ed024391d24298eb937c1adb47a76978d046 100644 (file)
@@ -42,8 +42,7 @@ pub trait OutlineDefn: Debug + Sync + Send + 'static {
     RectShape { xy: size }.into()
   }
 
-  fn load_mf1(&self, lgi: &GroupData, svg_sz: PosC<f64>)
-              -> Result<Outline,LLE>;
+  fn load_mf1(&self, group: &GroupData) -> Result<Outline,LLE>;
 }
 #[derive(Debug,Clone,Copy)]
 pub struct ShapeCalculable { }
@@ -651,9 +650,9 @@ impl GroupData {
   }
 
   #[throws(LibraryLoadError)]
-  fn load_shape(&self, svg_sz: PosC<f64>) -> (FaceTransform, Outline) {
+  fn load_shape(&self, _svg_sz: PosC<f64>) -> (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<f64>) -> 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<f64>) -> Outline {
+  fn load_mf1(&self, group: &GroupData) -> Outline {
     let diam = match group.d.size.as_slice() {
       &[c] => c,
       size => throw!(LLE::WrongNumberOfSizeDimensions