From 533a006bd1be4baf0463345c004676cf77e83cf5 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 3 Feb 2020 15:16:00 +0300 Subject: [PATCH] anvil.window_map: fix bbox computation It said max_y = y + w instead of y + h. --- anvil/src/window_map.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/anvil/src/window_map.rs b/anvil/src/window_map.rs index 10e0ef0..3498293 100644 --- a/anvil/src/window_map.rs +++ b/anvil/src/window_map.rs @@ -122,21 +122,17 @@ where x += subdata.location.0; y += subdata.location.1; } - // update the bounding box - if x < min_x { - min_x = x; - } - if y < min_y { - min_y = y; - } - if x + w > max_x { - max_x = x + w; - } - if y + h > max_y { - max_y = y + w; - } + + // Update the bounding box. + min_x = min_x.min(x); + min_y = min_y.min(y); + max_x = max_x.max(x + w); + max_y = max_y.max(y + h); + TraversalAction::DoChildren((x, y)) } else { + // If the parent surface is unmapped, then the child surfaces are hidden as + // well, no need to consider them here. TraversalAction::SkipChildren } },