From 538b48d08d58d606ae49423c664dae3f861eac9c Mon Sep 17 00:00:00 2001 From: Willow Barraco Date: Tue, 30 Jan 2024 09:35:03 +0100 Subject: [PATCH] fix fractional scalled buffer missing one pixel Before 1920*1080 scaled 1.40 was giving a buffer width of 1919 pixels. The buffer dimensions have to be ceiled here, instead of rounded. The rest of the dimensions have to stay the same, here 1371x120. Signed-off-by: Willow Barraco Signed-off-by: Maarten van Gompel --- drw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drw.c b/drw.c index 5c0b242..9f2a21a 100644 --- a/drw.c +++ b/drw.c @@ -4,6 +4,7 @@ #include "drw.h" #include "shm_open.h" +#include "math.h" void drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, double s) @@ -15,8 +16,8 @@ drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, double s) } ds->scale = s; - ds->width = w * s; - ds->height = h * s; + ds->width = ceil(w * s); + ds->height = ceil(h * s); setup_buffer(ds); }