From f181416095cea44d1b771fd201b4447a8cd56a0d Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 4 May 2023 20:37:06 -0700 Subject: [PATCH] Renamed zoom for scale --- src/devices/screen.c | 6 +++--- src/devices/screen.h | 2 +- src/uxn11.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/devices/screen.c b/src/devices/screen.c index 7dc3c15..82decd4 100644 --- a/src/devices/screen.c +++ b/src/devices/screen.c @@ -75,7 +75,7 @@ screen_resize(UxnScreen *p, Uint16 width, Uint16 height) return; bg = realloc(p->bg.pixels, width * height), fg = realloc(p->fg.pixels, width * height); - pixels = realloc(p->pixels, width * height * sizeof(Uint32) * ZOOM * ZOOM); + pixels = realloc(p->pixels, width * height * sizeof(Uint32) * SCALE * SCALE); if(!bg || !fg || !pixels) return; p->bg.pixels = bg; @@ -91,12 +91,12 @@ void screen_redraw(UxnScreen *p) { Uint8 *fg = p->fg.pixels, *bg = p->bg.pixels; - Uint32 i, j, x, y, w = p->width * ZOOM, h = p->height * ZOOM, palette[16], *pixels = p->pixels; + Uint32 i, j, x, y, w = p->width * SCALE, h = p->height * SCALE, palette[16], *pixels = p->pixels; for(i = 0; i < 16; i++) palette[i] = p->palette[(i >> 2) ? (i >> 2) : (i & 3)]; for(y = 0; y < h; y++) for(x = 0; x < w; x++) { - j = ((x / ZOOM) + (y / ZOOM) * p->width); + j = ((x / SCALE) + (y / SCALE) * p->width); pixels[x + y * w] = palette[fg[j] << 2 | bg[j]]; } p->fg.changed = p->bg.changed = 0; diff --git a/src/devices/screen.h b/src/devices/screen.h index 4fd7193..a6d4543 100644 --- a/src/devices/screen.h +++ b/src/devices/screen.h @@ -10,7 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. */ -#define ZOOM 2 +#define SCALE 2 typedef struct Layer { Uint8 *pixels, changed; diff --git a/src/uxn11.c b/src/uxn11.c index 4668a75..0df27ea 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -72,7 +72,7 @@ static void emu_draw(void) { screen_redraw(&uxn_screen); - XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width * ZOOM, uxn_screen.height * ZOOM); + XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width * SCALE, uxn_screen.height * SCALE); } static int @@ -166,7 +166,7 @@ emu_event(Uxn *u) } break; case MotionNotify: { XMotionEvent *e = (XMotionEvent *)&ev; - mouse_pos(u, &u->dev[0x90], (e->x - PAD) / ZOOM, (e->y - PAD) / ZOOM); + mouse_pos(u, &u->dev[0x90], (e->x - PAD) / SCALE, (e->y - PAD) / SCALE); } break; } } @@ -177,7 +177,7 @@ display_start(char *title) Atom wmDelete; display = XOpenDisplay(NULL); visual = DefaultVisual(display, 0); - window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width * ZOOM + PAD * 2, uxn_screen.height * ZOOM + PAD * 2, 1, 0, 0); + window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width * SCALE + PAD * 2, uxn_screen.height * SCALE + PAD * 2, 1, 0, 0); if(visual->class != TrueColor) return system_error("init", "True-color visual failed"); XSelectInput(display, window, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | KeyPressMask | KeyReleaseMask); @@ -185,7 +185,7 @@ display_start(char *title) XSetWMProtocols(display, window, &wmDelete, 1); XStoreName(display, window, title); XMapWindow(display, window); - ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, uxn_screen.width * ZOOM, uxn_screen.height * ZOOM, 32, 0); + ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, uxn_screen.width * SCALE, uxn_screen.height * SCALE, 32, 0); hide_cursor(); return 1; }