summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/gdevbbox.c13
-rw-r--r--base/gdevbbox.h2
-rw-r--r--base/gsdevmem.c17
-rw-r--r--base/gslib.c5
-rw-r--r--base/gsshade.c5
-rw-r--r--base/gxp1fill.c9
-rw-r--r--base/gxshade1.c4
-rw-r--r--base/gxshade6.c2
-rw-r--r--xps/xpsopacity.c7
9 files changed, 44 insertions, 20 deletions
diff --git a/base/gdevbbox.c b/base/gdevbbox.c
index 4246883e9..8b4e63138 100644
--- a/base/gdevbbox.c
+++ b/base/gdevbbox.c
@@ -331,10 +331,11 @@ gx_device_bbox_release(gx_device_bbox *dev)
}
/* Read back the bounding box in 1/72" units. */
-void
+int
gx_device_bbox_bbox(gx_device_bbox * dev, gs_rect * pbbox)
{
gs_fixed_rect bbox;
+ int code;
BBOX_GET_BOX(dev, &bbox);
if (bbox.p.x > bbox.q.x || bbox.p.y > bbox.q.y) {
@@ -349,8 +350,11 @@ gx_device_bbox_bbox(gx_device_bbox * dev, gs_rect * pbbox)
dbox.q.x = fixed2float(bbox.q.x);
dbox.q.y = fixed2float(bbox.q.y);
gs_deviceinitialmatrix((gx_device *)dev, &mat);
- gs_bbox_transform_inverse(&dbox, &mat, pbbox);
+ code = gs_bbox_transform_inverse(&dbox, &mat, pbbox);
+ if (code < 0)
+ return code;
}
+ return 0;
}
static int
@@ -391,8 +395,11 @@ bbox_output_page(gx_device * dev, int num_copies, int flush)
* This is a free-standing device. Print the page bounding box.
*/
gs_rect bbox;
+ int code;
- gx_device_bbox_bbox(bdev, &bbox);
+ code = gx_device_bbox_bbox(bdev, &bbox);
+ if (code < 0)
+ return code;
dmlprintf4(dev->memory, "%%%%BoundingBox: %d %d %d %d\n",
(int)floor(bbox.p.x), (int)floor(bbox.p.y),
(int)ceil(bbox.q.x), (int)ceil(bbox.q.y));
diff --git a/base/gdevbbox.h b/base/gdevbbox.h
index e9fc9900b..ae993a5bc 100644
--- a/base/gdevbbox.h
+++ b/base/gdevbbox.h
@@ -136,7 +136,7 @@ void gx_device_bbox_set_white_opaque(gx_device_bbox *dev,
bool white_is_opaque);
/* Read back the bounding box in 1/72" units. */
-void gx_device_bbox_bbox(gx_device_bbox * dev, gs_rect * pbbox);
+int gx_device_bbox_bbox(gx_device_bbox * dev, gs_rect * pbbox);
/* Release a bounding box device. */
void gx_device_bbox_release(gx_device_bbox *dev);
diff --git a/base/gsdevmem.c b/base/gsdevmem.c
index e8040544a..75dd5680d 100644
--- a/base/gsdevmem.c
+++ b/base/gsdevmem.c
@@ -42,6 +42,16 @@ gs_initialize_wordimagedevice(gx_device_memory * new_dev, const gs_matrix * pmat
float x_pixels_per_unit, y_pixels_per_unit;
byte palette[256 * 3];
bool has_color;
+ int code;
+ gs_rect bbox;
+
+ bbox.p.x = 0;
+ bbox.p.y = 0;
+ bbox.q.x = width;
+ bbox.q.y = height;
+ code = gs_bbox_transform_inverse(&bbox, pmat, &bbox);
+ if (code < 0)
+ return code;
switch (colors_size) {
case 3 * 2:
@@ -194,13 +204,6 @@ gs_initialize_wordimagedevice(gx_device_memory * new_dev, const gs_matrix * pmat
gx_device_set_width_height((gx_device *) new_dev, width, height);
/* Set the ImagingBBox so we get a correct clipping region. */
{
- gs_rect bbox;
-
- bbox.p.x = 0;
- bbox.p.y = 0;
- bbox.q.x = width;
- bbox.q.y = height;
- gs_bbox_transform_inverse(&bbox, pmat, &bbox);
new_dev->ImagingBBox[0] = bbox.p.x;
new_dev->ImagingBBox[1] = bbox.p.y;
new_dev->ImagingBBox[2] = bbox.q.x;
diff --git a/base/gslib.c b/base/gslib.c
index a2e64042a..151da9a13 100644
--- a/base/gslib.c
+++ b/base/gslib.c
@@ -194,8 +194,11 @@ main(int argc, const char *argv[])
gs_output_page(pgs, 1, 1);
{
gs_rect bbox;
+ int code1;
- gx_device_bbox_bbox(bbdev, &bbox);
+ code1 = gx_device_bbox_bbox(bbdev, &bbox);
+ if (code1 < 0)
+ code = code1;
dmprintf4(mem, "Bounding box: [%g %g %g %g]\n",
bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
}
diff --git a/base/gsshade.c b/base/gsshade.c
index b64f77292..e6d036f5a 100644
--- a/base/gsshade.c
+++ b/base/gsshade.c
@@ -473,8 +473,9 @@ gs_shading_do_fill_rectangle(const gs_shading_t *psh,
path_rect.p.y = fixed2float(path_box.p.y);
path_rect.q.x = fixed2float(path_box.q.x);
path_rect.q.y = fixed2float(path_box.q.y);
- gs_bbox_transform_inverse(&path_rect, (const gs_matrix *)pmat, &rect);
- code = gs_shading_fill_rectangle(psh, &rect, &path_box, dev, pgs);
+ code = gs_bbox_transform_inverse(&path_rect, (const gs_matrix *)pmat, &rect);
+ if (code >= 0)
+ code = gs_shading_fill_rectangle(psh, &rect, &path_box, dev, pgs);
}
return code;
}
diff --git a/base/gxp1fill.c b/base/gxp1fill.c
index 7570e7b7d..406dd169c 100644
--- a/base/gxp1fill.c
+++ b/base/gxp1fill.c
@@ -175,7 +175,9 @@ tile_by_steps(tile_fill_state_t * ptfs, int x0, int y0, int w0, int h0,
bbox.p.x = x0, bbox.p.y = y0;
bbox.q.x = x1, bbox.q.y = y1;
- gs_bbox_transform_inverse(&bbox, &step_matrix, &ibbox);
+ code = gs_bbox_transform_inverse(&bbox, &step_matrix, &ibbox);
+ if (code < 0)
+ return code;
if_debug10m('T', mem,
"[T]x,y=(%d,%d) w,h=(%d,%d) => (%g,%g),(%g,%g), offset=(%g,%g)\n",
x0, y0, w0, h0,
@@ -616,6 +618,7 @@ tile_by_steps_trans(tile_fill_trans_state_t * ptfs, int x0, int y0, int w0, int
#ifdef DEBUG
const gs_memory_t *mem = ptile->ttrans->mem;
#endif
+ int code;
ptfs->x0 = x0, ptfs->w0 = w0;
ptfs->y0 = y0, ptfs->h0 = h0;
@@ -631,7 +634,9 @@ tile_by_steps_trans(tile_fill_trans_state_t * ptfs, int x0, int y0, int w0, int
bbox.p.x = x0, bbox.p.y = y0;
bbox.q.x = x1, bbox.q.y = y1;
- gs_bbox_transform_inverse(&bbox, &step_matrix, &ibbox);
+ code = gs_bbox_transform_inverse(&bbox, &step_matrix, &ibbox);
+ if (code < 0)
+ return code;
if_debug10m('T', mem,
"[T]x,y=(%d,%d) w,h=(%d,%d) => (%g,%g),(%g,%g), offset=(%g,%g)\n",
x0, y0, w0, h0,
diff --git a/base/gxshade1.c b/base/gxshade1.c
index 4f8979dc9..95dc7ee06 100644
--- a/base/gxshade1.c
+++ b/base/gxshade1.c
@@ -132,7 +132,9 @@ gs_shading_Fb_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
{
gs_rect pbox;
- gs_bbox_transform_inverse(rect, &psh->params.Matrix, &pbox);
+ code = gs_bbox_transform_inverse(rect, &psh->params.Matrix, &pbox);
+ if (code < 0)
+ return code;
x[0] = max(pbox.p.x, psh->params.Domain[0]);
x[1] = min(pbox.q.x, psh->params.Domain[1]);
y[0] = max(pbox.p.y, psh->params.Domain[2]);
diff --git a/base/gxshade6.c b/base/gxshade6.c
index eb865c850..adef2876f 100644
--- a/base/gxshade6.c
+++ b/base/gxshade6.c
@@ -1564,6 +1564,8 @@ decompose_linear_color(patch_fill_state_t *pfs, gs_fixed_edge *le, gs_fixed_edge
gs_fill_attributes fa;
gs_fixed_rect clip;
+ memset(fc, 0x99, sizeof(fc));
+
clip = pfs->rect;
if (swap_axes) {
fixed v;
diff --git a/xps/xpsopacity.c b/xps/xpsopacity.c
index 7ebb5e34a..11ae52e46 100644
--- a/xps/xpsopacity.c
+++ b/xps/xpsopacity.c
@@ -33,7 +33,9 @@ xps_bounds_in_user_space(xps_context_t *ctx, gs_rect *ubox)
dbox.p.y = fixed2float(clip_path->outer_box.p.y);
dbox.q.x = fixed2float(clip_path->outer_box.q.x);
dbox.q.y = fixed2float(clip_path->outer_box.q.y);
- gs_bbox_transform_inverse(&dbox, &ctm_only(ctx->pgs), ubox);
+ code = gs_bbox_transform_inverse(&dbox, &ctm_only(ctx->pgs), ubox);
+ if (code < 0)
+ gs_warn("gs_bbox_transform_inverse failed");
}
/* This will get the proper bounds based upon the current path, clip path
@@ -54,8 +56,7 @@ int xps_bounds_in_user_space_path_clip(xps_context_t *ctx, gs_rect *ubox,
}
if (code < 0)
return code;
- gs_bbox_transform_inverse(&bbox, &ctm_only(ctx->pgs), ubox);
- return code;
+ return gs_bbox_transform_inverse(&bbox, &ctm_only(ctx->pgs), ubox);
}
int