From c80e13579f3e6ca8fb1aac5a6d423d902747368d Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 7 Feb 2021 13:14:28 +0100 Subject: =?UTF-8?q?Dry-clean=20visitor=20with=20a=20macro=20=F0=9F=8F=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/export/pdf.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/export') diff --git a/src/export/pdf.rs b/src/export/pdf.rs index e5124c21..b2a6bbfd 100644 --- a/src/export/pdf.rs +++ b/src/export/pdf.rs @@ -130,11 +130,11 @@ impl<'a> PdfExporter<'a> { let mut content = Content::new(); for (pos, element) in &page.elements { + let x = pos.x.to_pt() as f32; match element { Element::Image(image) => { let name = format!("Im{}", self.images.map(image.res)); let size = image.size; - let x = pos.x.to_pt() as f32; let y = (page.size.height - pos.y - size.height).to_pt() as f32; let w = size.width.to_pt() as f32; let h = size.height.to_pt() as f32; @@ -151,16 +151,14 @@ impl<'a> PdfExporter<'a> { match geometry.fill { Fill::Color(Color::Rgba(c)) => { content.fill_rgb( - c.r as f32 / 255., - c.g as f32 / 255., - c.b as f32 / 255., + c.r as f32 / 255.0, + c.g as f32 / 255.0, + c.b as f32 / 255.0, ); } Fill::Image(_) => todo!(), } - let x = pos.x.to_pt() as f32; - match &geometry.shape { Shape::Rect(r) => { let w = r.width.to_pt() as f32; -- cgit v1.2.3