X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Fstructure.h;h=008c183421dd1a00a8148f5872240cc2d40d466c;hb=aac1ada93b1c972e964f53c47dccd0fe4f8aff3a;hp=10de443ed6e55169520bea1d7e4e57fd3610bb05;hpb=0826bbc65e59d47c270f05af419f24fdfc3c349c;p=ypp-sc-tools.db-test.git diff --git a/pctb/structure.h b/pctb/structure.h index 10de443..008c183 100644 --- a/pctb/structure.h +++ b/pctb/structure.h @@ -14,16 +14,6 @@ extern const CanonColourInfo canoncolourinfos[]; CanonImage *alloc_canon_image(int w, int h); -#ifdef DEBUG_RECTANGLES -# define CANIMG_DEBUG_RECTANGLE_1LINE(im,w,h) \ - fprintf(debug, "%4d ",y); \ - int r= fwrite(im->d + y*w, 1,w, debug); \ - eassert(r==w); \ - fputc('\n',debug); -#else -# define CANIMG_DEBUG_RECTANGLE_1LINE(im,y,h) /* nothing */ -#endif - #define CANONICALISE_IMAGE(im,w,h, COMPUTE_RGB) do{ \ /* compute_rgb should be a number of statements, or \ * a block, which assigns to \ @@ -42,13 +32,18 @@ CanonImage *alloc_canon_image(int w, int h); const CanonColourInfo *cci; \ unsigned long rgb; \ COMPUTE_RGB; \ - for (cci=canoncolourinfos; cci->c; cci++) \ + for (cci=canoncolourinfos; cci->c; cci++) { \ if (cci->rgb == rgb) { \ (im)->d[y*(w) + x]= cci->c; \ break; \ } \ + } \ + } \ + if (DEBUGP(rect)) { \ + fprintf(debug, "%4d ",y); \ + fwrite(im->d + y*w, 1,w, debug); \ + fputc('\n',debug); \ } \ - CANIMG_DEBUG_RECTANGLE_1LINE((im),(w),(h)) \ } \ debug_flush(); \ }while(0)