diff options
Diffstat (limited to 'src/export')
| -rw-r--r-- | src/export/mod.rs | 4 | ||||
| -rw-r--r-- | src/export/pdf/mod.rs | 2 | ||||
| -rw-r--r-- | src/export/render.rs | 16 |
3 files changed, 8 insertions, 14 deletions
diff --git a/src/export/mod.rs b/src/export/mod.rs index 8e18174d..eb0731a9 100644 --- a/src/export/mod.rs +++ b/src/export/mod.rs @@ -3,5 +3,5 @@ mod pdf; mod render; -pub use pdf::pdf; -pub use render::render; +pub use self::pdf::pdf; +pub use self::render::render; diff --git a/src/export/pdf/mod.rs b/src/export/pdf/mod.rs index 5f47043e..2547ddbf 100644 --- a/src/export/pdf/mod.rs +++ b/src/export/pdf/mod.rs @@ -174,7 +174,7 @@ where &'a self, refs: &'a [Ref], ) -> impl Iterator<Item = (Ref, usize)> + 'a { - refs.iter().copied().zip(0 .. self.to_pdf.len()) + refs.iter().copied().zip(0..self.to_pdf.len()) } fn items(&self) -> impl Iterator<Item = &T> + '_ { diff --git a/src/export/render.rs b/src/export/render.rs index 41fff863..bc82e9c8 100644 --- a/src/export/render.rs +++ b/src/export/render.rs @@ -256,8 +256,8 @@ fn render_outline_glyph( // Blend the glyph bitmap with the existing pixels on the canvas. // FIXME: This doesn't respect the clipping mask. let pixels = bytemuck::cast_slice_mut::<u8, u32>(canvas.data_mut()); - for x in left.clamp(0, cw) .. right.clamp(0, cw) { - for y in top.clamp(0, ch) .. bottom.clamp(0, ch) { + for x in left.clamp(0, cw)..right.clamp(0, cw) { + for y in top.clamp(0, ch)..bottom.clamp(0, ch) { let ai = ((y - top) * mw + (x - left)) as usize; let cov = bitmap.coverage[ai]; if cov == 0 { @@ -312,10 +312,7 @@ fn render_shape( if let Some(Stroke { paint, thickness }) = shape.stroke { let paint = paint.into(); - let stroke = sk::Stroke { - width: thickness.to_f32(), - ..Default::default() - }; + let stroke = sk::Stroke { width: thickness.to_f32(), ..Default::default() }; canvas.stroke_path(&path, &paint, &stroke, ts, mask); } @@ -342,11 +339,8 @@ fn render_image( match image.decode().unwrap() { DecodedImage::Raster(dynamic, _) => { let downscale = w < image.width(); - let filter = if downscale { - FilterType::Lanczos3 - } else { - FilterType::CatmullRom - }; + let filter = + if downscale { FilterType::Lanczos3 } else { FilterType::CatmullRom }; let buf = dynamic.resize(w, h, filter); for ((_, _, src), dest) in buf.pixels().zip(pixmap.pixels_mut()) { let Rgba([r, g, b, a]) = src; |
