X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fdraw%2Flco-test.c;h=bb45e187cff14a4c2bec6bd384cbabc8161c89fb;hb=99b9f6386018ad201c5defc595b22bf6d5d825fe;hp=0221fbb9a71a07fe4ca00c06ed98793b5524b2a7;hpb=d804a00a7576d5e3c59c413762248787a1282c16;p=fw%2Faltos diff --git a/src/draw/lco-test.c b/src/draw/lco-test.c index 0221fbb9..bb45e187 100644 --- a/src/draw/lco-test.c +++ b/src/draw/lco-test.c @@ -16,41 +16,19 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define IMAGE_SCALE 8 -#define WIDTH 128 -#define HEIGHT 64 - -#define IMAGE_WIDTH (WIDTH * IMAGE_SCALE) -#define IMAGE_HEIGHT (HEIGHT * IMAGE_SCALE) - -#define DEFAULT_WIDTH IMAGE_WIDTH -#define DEFAULT_HEIGHT IMAGE_HEIGHT - #define TIMEOUT 50 #define PASS_KEYS -#include "frame.c" -#include "ao_draw.h" +#include "test-frame.c" -#define STRIDE ((WIDTH + 31) / 32) - -static uint32_t bits[STRIDE * HEIGHT]; - -static struct ao_bitmap fb = { - .base = bits, - .stride = STRIDE, - .width = WIDTH, - .height = HEIGHT -}; - -#define BIG_FONT FrutigerLT_Roman_64_font -#define VOLT_FONT FrutigerLT_Roman_64_font -#define SMALL_FONT NotoMono_12_font -#define TINY_FONT NotoMono_10_font +#define BIG_FONT BitstreamVeraSans_Roman_58_font +#define VOLT_FONT BitstreamVeraSans_Roman_58_font +#define SMALL_FONT BitstreamVeraSans_Roman_12_font +#define TINY_FONT BitstreamVeraSans_Roman_12_font #define LOGO_FONT BenguiatGothicStd_Bold_26_font #define LABEL_Y (int16_t) (SMALL_FONT.ascent) -#define VALUE_Y (int16_t) (LABEL_Y + BIG_FONT.ascent) +#define VALUE_Y (int16_t) (LABEL_Y + BIG_FONT.ascent + 3) #define BOX_X 2 #define PAD_X 90 #define BOX_LABEL_X 30 @@ -58,6 +36,12 @@ static struct ao_bitmap fb = { #define RSSI_LABEL_X 15 #define PAD_LABEL_X 95 #define SEP_X (PAD_X - 10) +#define SCAN_X (WIDTH - 100) / 2 +#define SCAN_Y 49 +#define SCAN_HEIGHT 4 +#define FOUND_Y 63 +#define FOUND_WIDTH 21 +#define MAX_VALID (WIDTH / FOUND_WIDTH) static int box_number = 1; static int pad_number = 1; @@ -102,13 +86,6 @@ static const struct ao_transform logo_transform = { .y_scale = 48, .y_off = 0, }; -#define SCAN_X (WIDTH - 100) / 2 -#define SCAN_Y 51 -#define SCAN_HEIGHT 4 -#define FOUND_Y 64 -#define FOUND_WIDTH 14 -#define MAX_VALID (WIDTH / FOUND_WIDTH) - static const struct ao_transform bowtie_transform = { .x_scale = 1, .x_off = 50, .y_scale = 1, .y_off = 20, @@ -118,10 +95,6 @@ static const float pad_volts = 12.3f; static const float lco_volts = 4.1f; static const int rssi = -30; -#define IMAGE_STRIDE ((IMAGE_WIDTH + 31) / 32) - -static uint32_t image_bits[IMAGE_STRIDE * IMAGE_HEIGHT]; - static int boxes[] = { 1, 2, 3, 5, 8, 11, 13, 17, 19, 23, 29, 31, 37, 62, 97 }; static int max_box = 97; @@ -241,26 +214,7 @@ void HandleExpose(Display *dpy, Window win, GC gc) break; } - XImage *source_image = XCreateImage(dpy, visual, 1, XYBitmap, 0, (char *) bits, WIDTH, HEIGHT, 32, STRIDE*4); - XImage *image = XCreateImage(dpy, visual, 1, XYBitmap, 0, (char *) image_bits, IMAGE_WIDTH, IMAGE_HEIGHT, 32, IMAGE_STRIDE * 4); - int ix, iy; - int dx, dy; - - for (iy = 0; iy < HEIGHT; iy++) { - for (ix = 0; ix < WIDTH; ix++) { - unsigned long bit = XGetPixel(source_image, ix, iy); - for (dy = 0; dy < IMAGE_SCALE; dy++) { - - for (dx = 0; dx < IMAGE_SCALE; dx++) { - XPutPixel(image, ix * IMAGE_SCALE + dx, iy * IMAGE_SCALE + dy, bit); - } - } - } - } - XSetForeground(dpy, gc, WhitePixel(dpy, screen)); - XSetBackground(dpy, gc, BlackPixel(dpy, screen)); - XPutImage(dpy, win, gc, image, 0, 0, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); - free(image); + DoDisplay(dpy, win, gc); } void