From 8d81b584a0c075cf4381e5e203bfa782d7e5fd0d Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 31 Jan 2013 01:11:18 -0300 Subject: [PATCH] ubb-la/gui.c (XWIDTH): move view width into macro instead of open-coding it --- ubb-la/gui.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ubb-la/gui.c b/ubb-la/gui.c index f73c234..c448471 100644 --- a/ubb-la/gui.c +++ b/ubb-la/gui.c @@ -44,6 +44,7 @@ #define DIV_RGBA 0x808080ff /* divisions */ #define XCENTER ((XRES+CH_XOFF)/2) +#define XWIDTH (XRES-CH_XOFF) #define MAP_BUF_Y0 2 #define MAP_BUF_Y1 8 @@ -150,7 +151,7 @@ static void show_map(int skip, int nibbles, int s0, int s1) int m = (nibbles+skip) >> 1; int scale = 0; - while (w >= (XRES-CH_XOFF)/2) { + while (w >= XWIDTH/2) { w >>= 1; scale++; } @@ -351,7 +352,7 @@ static void show_freq(double freq) static void show_divisions(void) { - int n = (XRES-CH_XOFF)/2/DIV_X; + int n = XWIDTH/2/DIV_X; int i; for (i = -n; i <= n; i++) @@ -377,7 +378,7 @@ void gui(const uint8_t *buf, int skip, int nibbles, double freq) int min_zoom = 0; int i; - while (XRES-CH_XOFF < (nibbles-skip) >> -min_zoom) + while (XWIDTH < (nibbles-skip) >> -min_zoom) min_zoom--; zoom = min_zoom; while (1) {