mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
Merge branch 'github/fork/zsugabubus/scale-round' into 'master'
scene: fix scaling of negative coordinates See merge request wlroots/wlroots!3312
This commit is contained in:
commit
c7d501b634
1 changed files with 3 additions and 3 deletions
|
|
@ -347,14 +347,14 @@ static void output_to_buffer_coords(pixman_region32_t *damage, struct wlr_output
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scale_length(int length, int offset, float scale) {
|
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) {
|
static void scale_box(struct wlr_box *box, float scale) {
|
||||||
box->width = scale_length(box->width, box->x, scale);
|
box->width = scale_length(box->width, box->x, scale);
|
||||||
box->height = scale_length(box->height, box->y, scale);
|
box->height = scale_length(box->height, box->y, scale);
|
||||||
box->x = round(box->x * scale);
|
box->x = box->x * scale + .5f;
|
||||||
box->y = round(box->y * scale);
|
box->y = box->y * scale + .5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void transform_output_box(struct wlr_box *box, const struct render_data *data) {
|
static void transform_output_box(struct wlr_box *box, const struct render_data *data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue