diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-12 23:12:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-12 23:12:56 +0200 |
commit | b80cf982ae5151775a11a2b579eae41ffa9d3e14 (patch) | |
tree | d73f1824e5d76f4a6556e1d9a880329517847e00 /sway/desktop/output.c | |
parent | f52af18e0d5e9eb1b28f237192cb9c22656e3247 (diff) | |
parent | c699a86e472d81c4654f19d39e42eb8cfd64bd94 (diff) |
Merge pull request #2825 from RyanDwyer/fractional-scale-pixel-leaks
Fix pixel leaks when using fractional scaling
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index adc1ee10..fc52dd28 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -223,11 +223,15 @@ void output_drag_icons_for_each_surface(struct sway_output *output, } } +static int scale_length(int length, int offset, float scale) { + return round((offset + length) * scale) - round(offset * scale); +} + static void scale_box(struct wlr_box *box, float scale) { - box->x *= scale; - box->y *= scale; - box->width *= scale; - box->height *= 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); } struct sway_workspace *output_get_active_workspace(struct sway_output *output) { |