layout: fix build on i386

Due to the (lack of) precision of floating-point values, comparison
results may differ slightly between architectures, leading to the
`check_stretching` test failing when building for i386. This can be
fixed by adjusting the value against which we compare the ratio between
x/y scaling factors in `calculate_transformation`.
This commit is contained in:
Arnaud Ferraris
2022-04-20 11:52:43 +02:00
parent 05e7cde8fa
commit 58c7fe98b8

View File

@ -761,7 +761,7 @@ impl Layout {
let h_scale = available.width / size.width; let h_scale = available.width / size.width;
let v_scale = available.height / size.height; let v_scale = available.height / size.height;
// Allow up to 5% (and a bit more) horizontal stretching for filling up available space // Allow up to 5% (and a bit more) horizontal stretching for filling up available space
let scale_x = if (h_scale / v_scale) < 1.06 { h_scale } else { v_scale }; let scale_x = if (h_scale / v_scale) < 1.055 { h_scale } else { v_scale };
let scale_y = cmp::min(FloatOrd(h_scale), FloatOrd(v_scale)).0; let scale_y = cmp::min(FloatOrd(h_scale), FloatOrd(v_scale)).0;
let outside_margins = c::Transformation { let outside_margins = c::Transformation {
origin_x: (available.width - (scale_x * size.width)) / 2.0, origin_x: (available.width - (scale_x * size.width)) / 2.0,