diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2011-08-03 00:15:55 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2011-08-03 00:15:55 +0100 |
commit | 3216a4e3d42f335ecc38c6836d8494b747868d9d (patch) | |
tree | 7af092e1a4170ebdab14f75b52c7c3e45f2ea05e /draw | |
parent | 993e6144cfd2d9e4f67ecd03bd60c0e3b9327f9d (diff) | |
download | mupdf-3216a4e3d42f335ecc38c6836d8494b747868d9d.tar.xz |
Add (disabled by default) debug code for group blends.
Some code that I find useful for debugging the group blending code.
Diffstat (limited to 'draw')
-rw-r--r-- | draw/draw_device.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c index 8042ce84..3367c185 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -6,6 +6,9 @@ #define STACK_SIZE 96 +/* Enable the following to help debug group blending. */ +#undef DUMP_GROUP_BLENDS + typedef struct fz_draw_device_s fz_draw_device; enum { @@ -38,6 +41,25 @@ struct fz_draw_device_s } stack[STACK_SIZE]; }; +#ifdef DUMP_GROUP_BLENDS +static int group_dump_count = 0; + +static void fz_dump_blend(fz_pixmap *pix, const char *s) +{ + char name[80]; + + if (pix == NULL) + return; + + sprintf(name, "dump%02d.png", group_dump_count); + if (s) + printf("%s%02d", s, group_dump_count); + group_dump_count++; + + fz_write_png(pix, name, (pix->n > 1)); +} +#endif + static void fz_knockout_begin(void *user) { fz_draw_device *dev = user; @@ -1211,6 +1233,22 @@ fz_draw_end_group(void *user) dev->dest = dev->stack[dev->top].dest; dev->scissor = dev->stack[dev->top].scissor; +#ifdef DUMP_GROUP_BLENDS + fz_dump_blend(group, "Blending "); + if (shape) + fz_dump_blend(shape, "/"); + fz_dump_blend(dev->dest, " onto "); + if (dev->shape) + fz_dump_blend(dev->shape, "/"); + if (alpha != 1.0f) + printf(" (alpha %g)", alpha); + if (blendmode != 0) + printf(" (blend %d)", blendmode); + if (isolated != 0) + printf(" (isolated)"); + if (blendmode != 0) + printf(" (knockout)"); +#endif if ((blendmode == 0) && (shape == NULL)) fz_paint_pixmap(dev->dest, group, alpha * 255); else @@ -1225,6 +1263,12 @@ fz_draw_end_group(void *user) } fz_drop_pixmap(shape); } +#ifdef DUMP_GROUP_BLENDS + fz_dump_blend(dev->dest, " to get "); + if (dev->shape) + fz_dump_blend(dev->shape, "/"); + printf("\n"); +#endif } if (dev->blendmode & FZ_BLEND_KNOCKOUT) |