From 339e1ad7adb8340732ee856d0f6f0d2c7f1455d1 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 14:14:28 +0300 Subject: Inline trivial internal helpers at their call sites --- tests/x11/test_tablet_native.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'tests/x11') diff --git a/tests/x11/test_tablet_native.c b/tests/x11/test_tablet_native.c index 6e7eeb4..f12ec7f 100644 --- a/tests/x11/test_tablet_native.c +++ b/tests/x11/test_tablet_native.c @@ -75,11 +75,6 @@ static void pump(int fd, struct yasl_display *display, struct yasl_surface *surf assert(!app->failed); } -static uint32_t canvas_pixel(struct app *app, int x, int y) -{ - return app->canvas[(size_t)y * app->geometry.size.x + x]; -} - static void set_eraser_property(Display *display) { int count = 0; @@ -134,20 +129,21 @@ int main(int argc, char **argv) pump(pen_fd, display, surface, &app); assert(app.visible && !app.down && app.pointer.device == YASL_PTR_DEV_PEN); assert(app.pointer.pos.x == 150 && app.pointer.pos.y == 200); - assert(canvas_pixel(&app, 150, 200) == PAPER); + assert(app.canvas[(size_t)200 * app.geometry.size.x + 150] == PAPER); xf86ITEventButton button = {.header = {sizeof(button), XF86IT_EVENT_BUTTON}, .is_absolute = 1, .button = 1, .is_press = 1, .valuators = motion.valuators}; button.valuators.valuators[4] = 250; /* Driver pressure range is 0..1000. */ send_all(pen_fd, &button, sizeof(button)); pump(pen_fd, display, surface, &app); assert(app.down && app.pointer.pen.pressure == 16384); - assert(canvas_pixel(&app, 150, 200) == INK && canvas_pixel(&app, 170, 200) == PAPER); + assert(app.canvas[(size_t)200 * app.geometry.size.x + 150] == INK && + app.canvas[(size_t)200 * app.geometry.size.x + 170] == PAPER); motion.valuators.mask[0] = 1 << 4; /* No position change. */ motion.valuators.valuators[4] = 1000; send_all(pen_fd, &motion, sizeof(motion)); pump(pen_fd, display, surface, &app); assert(app.down && app.pointer.pen.pressure == 65535); - assert(canvas_pixel(&app, 170, 200) == INK); + assert(app.canvas[(size_t)200 * app.geometry.size.x + 170] == INK); /* Check the actual window's pixels too, after the example presents. */ XImage *image = XGetImage(x, window, 170, 200, 1, 1, AllPlanes, ZPixmap); assert(image && (XGetPixel(image, 0, 0) & 0xffffff) == (INK & 0xffffff)); @@ -165,7 +161,8 @@ int main(int argc, char **argv) send_all(eraser_fd, &button, sizeof(button)); pump(eraser_fd, display, surface, &app); assert(app.down && app.pointer.device == YASL_PTR_DEV_ERASER && app.pointer.pen.pressure == 65535); - assert(canvas_pixel(&app, 150, 200) == PAPER && canvas_pixel(&app, 170, 200) == PAPER); + assert(app.canvas[(size_t)200 * app.geometry.size.x + 150] == PAPER && + app.canvas[(size_t)200 * app.geometry.size.x + 170] == PAPER); button.is_press = 0; send_all(eraser_fd, &button, sizeof(button)); pump(eraser_fd, display, surface, &app); -- cgit v1.2.3