1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

Ungeneralize wrlib DEBUG

Plus debug messages belong on stderr.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
This commit is contained in:
Tamas TEVESZ
2010-09-23 01:58:09 +02:00
committed by Carlos R. Mafra
parent b4b07c2cac
commit 758f4c80d1
2 changed files with 29 additions and 28 deletions

View File

@@ -263,8 +263,8 @@ static Bool allocatePseudoColor(RContext * ctx)
colors[i].flags = DoRed | DoGreen | DoBlue; colors[i].flags = DoRed | DoGreen | DoBlue;
break; /* succeeded, don't need to retry */ break; /* succeeded, don't need to retry */
} }
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("close color allocation failed. Retrying...\n"); fputs("close color allocation failed. Retrying...\n", stderr);
#endif #endif
} }
} }
@@ -323,18 +323,18 @@ static XColor *allocateGrayScale(RContext * ctx)
} }
/* try to allocate the colors */ /* try to allocate the colors */
for (i = 0; i < ncolors; i++) { for (i = 0; i < ncolors; i++) {
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("trying:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue); fprintf(stderr, "trying:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#endif #endif
if (!XAllocColor(ctx->dpy, ctx->cmap, &(colors[i]))) { if (!XAllocColor(ctx->dpy, ctx->cmap, &(colors[i]))) {
colors[i].flags = 0; /* failed */ colors[i].flags = 0; /* failed */
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("failed:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue); fprintf(stderr, "failed:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#endif #endif
} else { } else {
colors[i].flags = DoRed | DoGreen | DoBlue; colors[i].flags = DoRed | DoGreen | DoBlue;
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("success:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue); fprintf(stderr, "success:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#endif #endif
} }
} }
@@ -367,10 +367,10 @@ static XColor *allocateGrayScale(RContext * ctx)
} }
} }
/* allocate closest color found */ /* allocate closest color found */
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("best match:%x,%x,%x => %x,%x,%x\n", colors[i].red, colors[i].green, fprintf(stderr, "best match:%x,%x,%x => %x,%x,%x\n",
colors[i].blue, avcolors[closest].red, avcolors[closest].green, colors[i].red, colors[i].green, colors[i].blue,
avcolors[closest].blue); avcolors[closest].red, avcolors[closest].green, avcolors[closest].blue);
#endif #endif
colors[i].red = avcolors[closest].red; colors[i].red = avcolors[closest].red;
colors[i].green = avcolors[closest].green; colors[i].green = avcolors[closest].green;
@@ -379,8 +379,8 @@ static XColor *allocateGrayScale(RContext * ctx)
colors[i].flags = DoRed | DoGreen | DoBlue; colors[i].flags = DoRed | DoGreen | DoBlue;
break; /* succeeded, don't need to retry */ break; /* succeeded, don't need to retry */
} }
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("close color allocation failed. Retrying...\n"); fputs("close color allocation failed. Retrying...\n", stderr);
#endif #endif
} }
} }

View File

@@ -327,8 +327,8 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * image)
unsigned char *ptr = image->data; unsigned char *ptr = image->data;
/* fake match */ /* fake match */
#ifdef DEBUG #ifdef WRLIB_DEBUG
puts("true color match"); fputs("true color match\n", stderr);
#endif #endif
if (rmask == 0xff && gmask == 0xff && bmask == 0xff) { if (rmask == 0xff && gmask == 0xff && bmask == 0xff) {
for (y = 0; y < image->height; y++) { for (y = 0; y < image->height; y++) {
@@ -356,8 +356,8 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * image)
const int dg = 0xff / gmask; const int dg = 0xff / gmask;
const int db = 0xff / bmask; const int db = 0xff / bmask;
#ifdef DEBUG #ifdef WRLIB_DEBUG
puts("true color dither"); fputs("true color dither\n", stderr);
#endif #endif
#ifdef ASM_X86_MMX #ifdef ASM_X86_MMX
@@ -538,8 +538,8 @@ static RXImage *image2PseudoColor(RContext * ctx, RImage * image)
if (ctx->attribs->render_mode == RBestMatchRendering) { if (ctx->attribs->render_mode == RBestMatchRendering) {
/* fake match */ /* fake match */
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("pseudo color match with %d colors per channel\n", cpc); fprintf(stderr, "pseudo color match with %d colors per channel\n", cpc);
#endif #endif
for (y = 0; y < image->height; y++) { for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++, ptr += channels - 3) { for (x = 0; x < image->width; x++, ptr += channels - 3) {
@@ -560,8 +560,8 @@ static RXImage *image2PseudoColor(RContext * ctx, RImage * image)
const int dg = 0xff / gmask; const int dg = 0xff / gmask;
const int db = 0xff / bmask; const int db = 0xff / bmask;
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("pseudo color dithering with %d colors per channel\n", cpc); fprintf(stderr, "pseudo color dithering with %d colors per channel\n", cpc);
#endif #endif
err = malloc(4 * (image->width + 3)); err = malloc(4 * (image->width + 3));
nerr = malloc(4 * (image->width + 3)); nerr = malloc(4 * (image->width + 3));
@@ -638,8 +638,9 @@ static RXImage *image2StandardPseudoColor(RContext * ctx, RImage * image)
int rer, ger, ber; int rer, ger, ber;
int x1, ofs; int x1, ofs;
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("pseudo color dithering with %d colors per channel\n", ctx->attribs->colors_per_channel); fprintf(stderr, "pseudo color dithering with %d colors per channel\n",
ctx->attribs->colors_per_channel);
#endif #endif
err = (short *)malloc(3 * (image->width + 2) * sizeof(short)); err = (short *)malloc(3 * (image->width + 2) * sizeof(short));
nerr = (short *)malloc(3 * (image->width + 2) * sizeof(short)); nerr = (short *)malloc(3 * (image->width + 2) * sizeof(short));
@@ -769,8 +770,8 @@ static RXImage *image2GrayScale(RContext * ctx, RImage * image)
if (ctx->attribs->render_mode == RBestMatchRendering) { if (ctx->attribs->render_mode == RBestMatchRendering) {
/* fake match */ /* fake match */
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("grayscale match with %d colors per channel\n", cpc); fprintf(stderr, "grayscale match with %d colors per channel\n", cpc);
#endif #endif
for (y = 0; y < image->height; y++) { for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++) { for (x = 0; x < image->width; x++) {
@@ -789,8 +790,8 @@ static RXImage *image2GrayScale(RContext * ctx, RImage * image)
int ger; int ger;
const int dg = 0xff / gmask; const int dg = 0xff / gmask;
#ifdef DEBUG #ifdef WRLIB_DEBUG
printf("grayscale dither with %d colors per channel\n", cpc); fprintf(stderr, "grayscale dither with %d colors per channel\n", cpc);
#endif #endif
gerr = (short *)malloc((image->width + 2) * sizeof(short)); gerr = (short *)malloc((image->width + 2) * sizeof(short));
ngerr = (short *)malloc((image->width + 2) * sizeof(short)); ngerr = (short *)malloc((image->width + 2) * sizeof(short));