diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-12-07 17:58:00 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-12-07 17:58:00 +0000 |
commit | d0724c562bb7ae6ad81eb89b064d59a73685f3a8 (patch) | |
tree | 7238cb73894d18e3c825c87bd0b5f9d36d46d603 /draw/draw_device.c | |
parent | 3ba82448cf800672e1c2aa4dd4a6778154c7e29f (diff) | |
download | mupdf-d0724c562bb7ae6ad81eb89b064d59a73685f3a8.tar.xz |
Fix tile coverage calculations.
The code attempts to spot cases where a pattern tile is so large that
only 1 repeat is visible. Due to rounding errors, this test could
sometimes fail, and (on badly formed files) we'd attempt to allocate
huge pixmaps.
The fix is to allow for rounding errors.
Diffstat (limited to 'draw/draw_device.c')
-rw-r--r-- | draw/draw_device.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c index 7e40ef3f..cb6760ea 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -1437,6 +1437,11 @@ fz_draw_begin_tile(fz_device *devp, fz_rect area, fz_rect view, float xstep, flo fz_knockout_begin(dev); bbox = fz_round_rect(fz_transform_rect(ctm, view)); + /* We should never have a bbox that entirely covers our destination. + * If we do, then the check for only 1 tile being visible above has + * failed. */ + assert(bbox.x0 > dev->dest->x || bbox.x1 < dev->dest->x + dev->dest->w || + bbox.y0 > dev->dest->y || bbox.y1 < dev->dest->y + dev->dest->h); dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); /* FIXME: See note #1 */ fz_clear_pixmap(dest); |