From: Ian Jackson Date: Mon, 9 May 2022 23:46:35 +0000 (+0100) Subject: mformat 1: Have FaceTransform::from_group_mf1 take the GroupData X-Git-Tag: otter-1.1.0~246 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a14c79e152e2659b0c684e1a84993adf960c017e;p=otter.git 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 --- 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) }