diff options
Diffstat (limited to 'xps')
-rw-r--r-- | xps/xps_gradient.c | 17 | ||||
-rw-r--r-- | xps/xps_image.c | 11 | ||||
-rw-r--r-- | xps/xps_path.c | 2 |
3 files changed, 22 insertions, 8 deletions
diff --git a/xps/xps_gradient.c b/xps/xps_gradient.c index 8bdc3cc5..7533c4d3 100644 --- a/xps/xps_gradient.c +++ b/xps/xps_gradient.c @@ -312,6 +312,11 @@ xps_draw_radial_gradient(xps_document *doc, fz_matrix ctm, char *radius_x_att = xml_att(root, "RadiusX"); char *radius_y_att = xml_att(root, "RadiusY"); + x0 = y0 = 0.0; + x1 = y1 = 1.0; + xrad = 1.0; + yrad = 1.0; + if (origin_att) sscanf(origin_att, "%g,%g", &x0, &y0); if (center_att) @@ -322,11 +327,15 @@ xps_draw_radial_gradient(xps_document *doc, fz_matrix ctm, yrad = fz_atof(radius_y_att); /* scale the ctm to make ellipses */ - ctm = fz_concat(fz_scale(1, yrad / xrad), ctm); + if (xrad != 0.0) + ctm = fz_concat(fz_scale(1, yrad / xrad), ctm); - invscale = xrad / yrad; - y0 = y0 * invscale; - y1 = y1 * invscale; + if (yrad != 0.0) + { + invscale = xrad / yrad; + y0 = y0 * invscale; + y1 = y1 * invscale; + } r0 = 0; r1 = xrad; diff --git a/xps/xps_image.c b/xps/xps_image.c index 6ba017da..85a467af 100644 --- a/xps/xps_image.c +++ b/xps/xps_image.c @@ -28,9 +28,14 @@ xps_paint_image_brush(xps_document *doc, fz_matrix ctm, fz_rect area, char *base xml_element *root, void *vimage) { fz_pixmap *pixmap = vimage; - float xs = pixmap->w * 96 / pixmap->xres; - float ys = pixmap->h * 96 / pixmap->yres; - fz_matrix im = fz_scale(xs, -ys); + float xs, ys; + fz_matrix im; + + if (pixmap->xres == 0 || pixmap->yres == 0) + return; + xs = pixmap->w * 96 / pixmap->xres; + ys = pixmap->h * 96 / pixmap->yres; + im = fz_scale(xs, -ys); im.f = ys; ctm = fz_concat(im, ctm); fz_fill_image(doc->dev, pixmap, ctm, doc->opacity[doc->opacity_top]); diff --git a/xps/xps_path.c b/xps/xps_path.c index ead2c7fa..402ca532 100644 --- a/xps/xps_path.c +++ b/xps/xps_path.c @@ -145,7 +145,7 @@ xps_draw_arc(fz_context *doc, fz_path *path, /* F.6.6.1 -- ensure radii are positive and non-zero */ rx = fabsf(rx); ry = fabsf(ry); - if (rx < 0.001f || ry < 0.001f) + if (rx < 0.001f || ry < 0.001f || (x1 == x2 && y1 == y2)) { fz_lineto(doc, path, x2, y2); return; |