Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

scene: fix scaling of negative coordinates #3312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions types/scene/wlr_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,14 @@ static void scene_node_get_size(struct wlr_scene_node *node,
}

static int scale_length(int length, int offset, float scale) {
return round((offset + length) * scale) - round(offset * scale);
return (int)((offset + length) * scale + .5f) - (int)(offset * scale + .5f);
}

static void scale_box(struct wlr_box *box, float scale) {
box->width = scale_length(box->width, box->x, scale);
box->height = scale_length(box->height, box->y, scale);
box->x = round(box->x * scale);
box->y = round(box->y * scale);
box->x = box->x * scale + .5f;
box->y = box->y * scale + .5f;
}

static void _scene_node_damage_whole(struct wlr_scene_node *node,
Expand Down