From 61b19e4198451b35eb121b09d4831c2d78723e6f Mon Sep 17 00:00:00 2001 From: Victor Brekenfeld Date: Tue, 4 Jan 2022 18:05:43 +0100 Subject: [PATCH] renderer: fixup damage calculations for smaller buffer sizes --- src/backend/renderer/utils/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/backend/renderer/utils/mod.rs b/src/backend/renderer/utils/mod.rs index bbf65a8..08323a7 100644 --- a/src/backend/renderer/utils/mod.rs +++ b/src/backend/renderer/utils/mod.rs @@ -88,7 +88,7 @@ where let mut result = Ok(()); let damage = damage .iter() - .map(|geo| geo.to_f64().to_physical(scale).to_i32_round()) + .map(|geo| geo.to_f64().to_physical(scale).to_i32_up()) .collect::>(); with_surface_tree_upward( surface, @@ -160,7 +160,12 @@ where let rect = Rectangle::::from_loc_and_size( surface_offset.to_f64().to_physical(scale).to_i32_round(), - buffer_dimensions.unwrap(), + buffer_dimensions + .unwrap_or_default() + .to_logical(buffer_scale) + .to_f64() + .to_physical(scale) + .to_i32_round(), ); let new_damage = damage .iter()