From a14c79e152e2659b0c684e1a84993adf960c017e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 10 May 2022 00:46:35 +0100 Subject: [PATCH] mformat 1: Have FaceTransform::from_group_mf1 take the GroupData 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 --- src/shapelib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shapelib.rs b/src/shapelib.rs index 833d209a..0812eb88 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -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) -> (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) } -- 2.30.2