1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 20:25:19 +02:00

ubb-la/gui.c (DEBUG): make debugging fprintfs optional via DEBUG macro

This commit is contained in:
Werner Almesberger 2013-01-30 21:25:47 -03:00
parent 2d49a73aad
commit 533e9643ac

View File

@ -19,6 +19,13 @@
#include "gui.h" #include "gui.h"
#if 0
#define DEBUG(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
#define DEBUG(fmt, ...)
#endif
#define XRES 320 /* canvas width */ #define XRES 320 /* canvas width */
#define YRES 240 /* canvas height */ #define YRES 240 /* canvas height */
@ -98,8 +105,8 @@ static void show_buffer_zoom_in(const uint8_t *buf, int skip, int nibbles,
int last[4] = { -1, -1, -1, -1}; int last[4] = { -1, -1, -1, -1};
uint8_t v, bit; uint8_t v, bit;
fprintf(stderr, "in: %d-%d (%d) Sa %d-%d (%d) pix %d f (%d)\n", DEBUG("in: %d-%d (%d) Sa %d-%d (%d) pix %d f (%d)\n",
skip, nibbles, nibbles-skip, x0, x1, x1-x0, f, f*(nibbles-skip)); skip, nibbles, nibbles-skip, x0, x1, x1-x0, f, f*(nibbles-skip));
x = x0; x = x0;
for (i = skip; i != nibbles; i++) { for (i = skip; i != nibbles; i++) {
v = (buf[i >> 1] >> 4*(~i & 1)) & 0xf; v = (buf[i >> 1] >> 4*(~i & 1)) & 0xf;
@ -127,8 +134,8 @@ static void show_buffer_zoom_out(const uint8_t *buf, int skip, int nibbles,
int changes[4], last[4] = { -1, -1, -1, -1}, next[4]; int changes[4], last[4] = { -1, -1, -1, -1}, next[4];
uint8_t v, bit; uint8_t v, bit;
fprintf(stderr, "out: %d-%d (%d) Sa %d-%d (%d) pix %d f (%d)\n", DEBUG("out: %d-%d (%d) Sa %d-%d (%d) pix %d f (%d)\n",
skip, nibbles, nibbles-skip, x0, x1, x1-x0, f, f*(x1-x0)); skip, nibbles, nibbles-skip, x0, x1, x1-x0, f, f*(x1-x0));
for (x = x0; x != x1; x++) { for (x = x0; x != x1; x++) {
n = i+f; n = i+f;
for (j = 0; j != 4; j++) { for (j = 0; j != 4; j++) {