summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/fitz/device.c2
-rw-r--r--source/fitz/pixmap.c3
-rw-r--r--source/fitz/svg-device.c7
3 files changed, 7 insertions, 5 deletions
diff --git a/source/fitz/device.c b/source/fitz/device.c
index ed30e114..2d042ade 100644
--- a/source/fitz/device.c
+++ b/source/fitz/device.c
@@ -64,7 +64,7 @@ push_clip_stack(fz_device *dev, const fz_rect *rect)
dev->scissor[0] = *rect;
else
{
- dev->scissor[dev->scissor_len+1] = dev->scissor[dev->scissor_len];
+ dev->scissor[dev->scissor_len] = dev->scissor[dev->scissor_len-1];
fz_intersect_rect(&dev->scissor[dev->scissor_len], rect);
}
dev->scissor_len++;
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index a7cc8632..2d8b4c18 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -818,6 +818,9 @@ png_from_pixmap(fz_context *ctx, fz_pixmap *pix, int drop)
fz_var(out);
fz_var(pix2);
+ if (pix->w == 0 || pix->h == 0)
+ return NULL;
+
fz_try(ctx)
{
if (pix->colorspace && pix->colorspace != fz_device_gray(ctx) && pix->colorspace != fz_device_rgb(ctx))
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c
index d0efc261..6f3923ca 100644
--- a/source/fitz/svg-device.c
+++ b/source/fitz/svg-device.c
@@ -726,10 +726,9 @@ svg_dev_fill_shade(fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float
if (dev->scissor_len == 0)
return;
- if (fz_is_infinite_rect(&shade->bbox))
- fz_round_rect(&bbox, &dev->scissor[dev->scissor_len-1]);
- else
- fz_round_rect(&bbox, fz_intersect_rect(fz_bound_shade(ctx, shade, ctm, &rect), &dev->scissor[dev->scissor_len-1]));
+ fz_round_rect(&bbox, fz_intersect_rect(fz_bound_shade(ctx, shade, ctm, &rect), &dev->scissor[dev->scissor_len-1]));
+ if (fz_is_empty_irect(&bbox))
+ return;
pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), &bbox);
fz_clear_pixmap(ctx, pix);