Loaders: Debug macro cleanups

This commit is contained in:
Kim Woelders 2023-01-28 14:09:44 +01:00
parent 8c6c40097e
commit 495fb5e6f8
4 changed files with 12 additions and 16 deletions

View File

@ -69,15 +69,16 @@ typedef struct _ImlibImage ImlibImage;
#if IMLIB2_DEBUG
#define DC(M, fmt...) if (__imlib_debug & M) __imlib_printf(DBG_PFX, fmt)
#define DC(PFX, M, fmt...) if (__imlib_debug & M) __imlib_printf(PFX, fmt)
#define DBG_FILE 0x0001
#define DBG_LOAD 0x0002
#define DBG_LDR 0x0004
#define DBG_LDR2 0x0008
#define D(fmt...) DC(DBG_LDR, fmt)
#define DL(fmt...) DC(DBG_LDR2, fmt)
#define D(fmt...) DC(DBG_PFX, DBG_LDR, fmt)
#define Dx(fmt...) DC(NULL, DBG_LDR, fmt)
#define DL(fmt...) DC(DBG_PFX, DBG_LDR2, fmt)
extern unsigned int __imlib_debug;
@ -87,8 +88,9 @@ unsigned int __imlib_time_us(void);
#else
#define D(fmt...)
#define DC(fmt...)
#define D(fmt...)
#define Dx(fmt...)
#define DL(fmt...)
#endif /* IMLIB2_DEBUG */

View File

@ -8,12 +8,6 @@
#include "config.h"
#include "Imlib2_Loader.h"
#if IMLIB2_DEBUG
#define Dx(fmt...) if (__imlib_debug & DBG_LDR) __imlib_printf(NULL, fmt)
#else
#define Dx(fmt...)
#endif
#define DBG_PFX "LDR-ani"
#define T(a,b,c,d) ((a << 0) | (b << 8) | (c << 16) | (d << 24))

View File

@ -11,7 +11,7 @@
#include "Imlib2_Loader.h"
#define DBG_PFX "LDR-bmp"
#define Dx(fmt...)
#define DD(fmt...)
static const char *const _formats[] = { "bmp" };
@ -459,7 +459,7 @@ _load(ImlibImage * im, int load_data)
byte1 = buffer_ptr[0];
byte2 = buffer_ptr[1];
buffer_ptr += 2;
Dx("%3d %3d: %02x %02x (%d %d)\n",
DD("%3d %3d: %02x %02x (%d %d)\n",
x, y, byte1, byte2, byte2 >> 4, byte2 & 0xf);
if (byte1)
{
@ -520,7 +520,7 @@ _load(ImlibImage * im, int load_data)
for (j = 0; j < l; j++)
{
byte = *buffer_ptr++;
Dx("%3d %3d: %d/%d: %2d %2d\n",
DD("%3d %3d: %d/%d: %2d %2d\n",
x, y, j, l, byte >> 4, byte & 0xf);
*ptr++ = argbCmap[byte >> 4];
if (++j < l)
@ -583,7 +583,7 @@ _load(ImlibImage * im, int load_data)
byte1 = buffer_ptr[0];
byte2 = buffer_ptr[1];
buffer_ptr += 2;
Dx("%3d %3d: %02x %02x\n", x, y, byte1, byte2);
DD("%3d %3d: %02x %02x\n", x, y, byte1, byte2);
if (byte1)
{
pixel = argbCmap[byte2];
@ -632,7 +632,7 @@ _load(ImlibImage * im, int load_data)
for (j = 0; j < l; j++)
{
byte = *buffer_ptr++;
Dx("%3d %3d: %d/%d: %2d\n",
DD("%3d %3d: %d/%d: %2d\n",
x, y, j, l, byte);
*ptr++ = argbCmap[byte];
}

View File

@ -8,7 +8,7 @@
static const char *const _formats[] = { "tiff", "tif" };
#define DD(fmt...) DC(0x80, fmt)
#define DD(fmt...) DC(DBG_PFX, 0x80, fmt)
static struct {
const unsigned char *data, *dptr;