diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-06-12 17:16:14 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-06-12 17:26:18 +0200 |
| commit | 6e3b1a2c80428d581d00b9d65e1c45401df2e210 (patch) | |
| tree | 34d4b1c200851aa77af66b737bfe445e2da11f44 /src/export/render.rs | |
| parent | ed6550fdb08eae92bffab6b6b137b1e0eebf62c6 (diff) | |
Make all fields of `Frame` private
Diffstat (limited to 'src/export/render.rs')
| -rw-r--r-- | src/export/render.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/export/render.rs b/src/export/render.rs index 9f088433..1387015b 100644 --- a/src/export/render.rs +++ b/src/export/render.rs @@ -23,8 +23,9 @@ use crate::Context; /// compilation so that fonts and images can be rendered and rendering artifacts /// can be cached. pub fn render(ctx: &Context, frame: &Frame, pixel_per_pt: f32) -> sk::Pixmap { - let pxw = (pixel_per_pt * frame.size.x.to_f32()).round().max(1.0) as u32; - let pxh = (pixel_per_pt * frame.size.y.to_f32()).round().max(1.0) as u32; + let size = frame.size(); + let pxw = (pixel_per_pt * size.x.to_f32()).round().max(1.0) as u32; + let pxh = (pixel_per_pt * size.y.to_f32()).round().max(1.0) as u32; let mut canvas = sk::Pixmap::new(pxw, pxh).unwrap(); canvas.fill(sk::Color::WHITE); @@ -43,7 +44,7 @@ fn render_frame( ctx: &Context, frame: &Frame, ) { - for (pos, element) in &frame.elements { + for (pos, element) in frame.elements() { let x = pos.x.to_f32(); let y = pos.y.to_f32(); let ts = ts.pre_translate(x, y); @@ -80,8 +81,9 @@ fn render_group( let mut mask = mask; let mut storage; if group.clips { - let w = group.frame.size.x.to_f32(); - let h = group.frame.size.y.to_f32(); + let size = group.frame.size(); + let w = size.x.to_f32(); + let h = size.y.to_f32(); if let Some(path) = sk::Rect::from_xywh(0.0, 0.0, w, h) .map(sk::PathBuilder::from_rect) .and_then(|path| path.transform(ts)) |
