diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-06-12 19:54:35 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-06-15 14:57:51 +0000 |
commit | 3896b6b10790260cf90722c2a624a9cc8995f0e7 (patch) | |
tree | a32137cfbc766a5be3302c2d1ba590589b4d8a85 | |
parent | 7ce94597152bf8e681b6920e95837aa0db62dfef (diff) |
wlr_scene: Fix transforms with non 1 scale
wlr_region_transform / wlr_box_transform want unscaled coordinates here
-rw-r--r-- | types/scene/wlr_scene.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index f640d505..32967dbe 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -290,6 +290,7 @@ struct render_data { enum wl_output_transform transform; float scale; struct wlr_box logical; + int trans_width, trans_height; struct wlr_scene_output *output; @@ -299,14 +300,12 @@ struct render_data { static void transform_output_damage(pixman_region32_t *damage, const struct render_data *data) { enum wl_output_transform transform = wlr_output_transform_invert(data->transform); - wlr_region_transform(damage, damage, transform, - data->logical.width, data->logical.height); + wlr_region_transform(damage, damage, transform, data->trans_width, data->trans_height); } static void transform_output_box(struct wlr_box *box, const struct render_data *data) { enum wl_output_transform transform = wlr_output_transform_invert(data->transform); - wlr_box_transform(box, box, transform, - data->logical.width, data->logical.height); + wlr_box_transform(box, box, transform, data->trans_width, data->trans_height); } static void scene_damage_outputs(struct wlr_scene *scene, pixman_region32_t *damage) { @@ -1586,7 +1585,7 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output, }; output_pending_resolution(output, state, - &render_data.logical.width, &render_data.logical.height); + &render_data.trans_width, &render_data.trans_height); if (state->committed & WLR_OUTPUT_STATE_TRANSFORM) { render_data.transform = state->transform; @@ -1597,13 +1596,13 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output, } if (render_data.transform & WL_OUTPUT_TRANSFORM_90) { - int tmp = render_data.logical.width; - render_data.logical.width = render_data.logical.height; - render_data.logical.height = tmp; + int tmp = render_data.trans_width; + render_data.trans_width = render_data.trans_height; + render_data.trans_height = tmp; } - render_data.logical.width /= render_data.scale; - render_data.logical.height /= render_data.scale; + render_data.logical.width = render_data.trans_width / render_data.scale; + render_data.logical.height = render_data.trans_height / render_data.scale; struct render_list_constructor_data list_con = { .box = render_data.logical, |