summaryrefslogtreecommitdiff
path: root/src/export
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-07 13:14:28 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-07 13:14:28 +0100
commitc80e13579f3e6ca8fb1aac5a6d423d902747368d (patch)
treeee62a7b7517acd16e9b2b5133c7ad1bdceff0d3c /src/export
parentbfc2f5aefc6c407de0b699b31dafd835fc2c9be3 (diff)
Dry-clean visitor with a macro 🏜
Diffstat (limited to 'src/export')
-rw-r--r--src/export/pdf.rs10
1 files changed, 4 insertions, 6 deletions
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;