1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +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;
break; /* succeeded, don't need to retry */
}
#ifdef DEBUG
printf("close color allocation failed. Retrying...\n");
#ifdef WRLIB_DEBUG
fputs("close color allocation failed. Retrying...\n", stderr);
#endif
}
}
@@ -323,18 +323,18 @@ static XColor *allocateGrayScale(RContext * ctx)
}
/* try to allocate the colors */
for (i = 0; i < ncolors; i++) {
#ifdef DEBUG
printf("trying:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#ifdef WRLIB_DEBUG
fprintf(stderr, "trying:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#endif
if (!XAllocColor(ctx->dpy, ctx->cmap, &(colors[i]))) {
colors[i].flags = 0; /* failed */
#ifdef DEBUG
printf("failed:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#ifdef WRLIB_DEBUG
fprintf(stderr, "failed:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#endif
} else {
colors[i].flags = DoRed | DoGreen | DoBlue;
#ifdef DEBUG
printf("success:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#ifdef WRLIB_DEBUG
fprintf(stderr, "success:%x,%x,%x\n", colors[i].red, colors[i].green, colors[i].blue);
#endif
}
}
@@ -367,10 +367,10 @@ static XColor *allocateGrayScale(RContext * ctx)
}
}
/* allocate closest color found */
#ifdef DEBUG
printf("best match:%x,%x,%x => %x,%x,%x\n", colors[i].red, colors[i].green,
colors[i].blue, avcolors[closest].red, avcolors[closest].green,
avcolors[closest].blue);
#ifdef WRLIB_DEBUG
fprintf(stderr, "best match:%x,%x,%x => %x,%x,%x\n",
colors[i].red, colors[i].green, colors[i].blue,
avcolors[closest].red, avcolors[closest].green, avcolors[closest].blue);
#endif
colors[i].red = avcolors[closest].red;
colors[i].green = avcolors[closest].green;
@@ -379,8 +379,8 @@ static XColor *allocateGrayScale(RContext * ctx)
colors[i].flags = DoRed | DoGreen | DoBlue;
break; /* succeeded, don't need to retry */
}
#ifdef DEBUG
printf("close color allocation failed. Retrying...\n");
#ifdef WRLIB_DEBUG
fputs("close color allocation failed. Retrying...\n", stderr);
#endif
}
}

View File

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