chiark / gitweb /
mformat 1: Have FaceTransform::from_group_mf1 take the GroupData
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 May 2022 23:46:35 +0000 (00:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 May 2022 23:18:19 +0000 (00:18 +0100)
This gives access to mformat, which is useful for error
reporting (since it allows us to use the standard "can't do that in
this mf version" constructor).

Of course this is an _mf1 function so it doesn't need the actual
value - it could perhaps have made do with a proof token of const
generic type, or something.  But I tried that and it was a palaver.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/shapelib.rs

index 833d209a7b722254c99741ca520b1f1c52848918..0812eb886df3dd14be5d48d85e384c1fbbdf120b 100644 (file)
@@ -576,7 +576,8 @@ impl Catalogue {
 
 impl FaceTransform {
   #[throws(LLE)]
-  fn from_group_mf1(d: &GroupDetails) -> Self {
+  fn from_group_mf1(group: &GroupData) -> Self {
+    let d = &group.d;
     // by this point d.size has already been scaled by scale
     let scale = if ! d.orig_size.is_empty() && ! d.size.is_empty() {
       izip!(&d.orig_size, &d.size)
@@ -644,7 +645,7 @@ impl GroupData {
 
   #[throws(LibraryLoadError)]
   fn load_shape(&self, svg_sz: PosC<f64>) -> (FaceTransform, Outline) {
-    let xform = FaceTransform::from_group_mf1(&self.d)?;
+    let xform = FaceTransform::from_group_mf1(self)?;
     let outline = self.d.outline.load_mf1(&self, svg_sz)?;
     (xform, outline)
   }