chiark / gitweb /
add a brace to make it easier to add debug stuff
[ypp-sc-tools.db-live.git] / pctb / structure.h
index 10de443ed6e55169520bea1d7e4e57fd3610bb05..c6a8c9a9280a909a3dd296df2ad39551f93b1b01 100644 (file)
@@ -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,19 @@ 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);                               \
+       int r= fwrite(im->d + y*w, 1,w, debug);                 \
+       eassert(r==w);                                          \
+       fputc('\n',debug);                                      \
       }                                                                \
-      CANIMG_DEBUG_RECTANGLE_1LINE((im),(w),(h))               \
     }                                                          \
     debug_flush();                                             \
   }while(0)