summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2020-03-02 17:13:35 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2020-05-01 16:16:43 -0700
commitbc73bda1ff38c14698f67dad68d4411c80890a6a (patch)
treea91200dc05308ac0d69024eabdce7b2e0fc2a505
parent0c58d147f7cfa95fdf135ee62acc545300b1ce02 (diff)
downloadghostpdl-bc73bda1ff38c14698f67dad68d4411c80890a6a.tar.gz
Fix rect fill
-rw-r--r--base/gdevp14.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/base/gdevp14.c b/base/gdevp14.c
index cf2a9a0e2..d5891025a 100644
--- a/base/gdevp14.c
+++ b/base/gdevp14.c
@@ -5692,7 +5692,18 @@ pdf14_fill_rectangle_hl_color(gx_device *dev, const gs_fixed_rect *rect,
const gx_clip_path *pcpath)
{
pdf14_device *pdev = (pdf14_device *)dev;
- pdf14_buf *buf = pdev->ctx->stack;
+ pdf14_buf* buf;
+ int code;
+
+ /* Check if a context stack is set */
+ if (pdev->ctx->stack == NULL) {
+ code = pdf14_initialize_ctx(dev, dev->color_info.num_components,
+ dev->color_info.polarity != GX_CINFO_POLARITY_SUBTRACTIVE);
+ if (code < 0)
+ return code;
+ }
+ buf = pdev->ctx->stack;
+
int x = fixed2int(rect->p.x);
int y = fixed2int(rect->p.y);
int w = fixed2int(rect->q.x) - x;
@@ -5713,7 +5724,17 @@ pdf14_fill_rectangle(gx_device * dev,
int x, int y, int w, int h, gx_color_index color)
{
pdf14_device *pdev = (pdf14_device *)dev;
- pdf14_buf *buf = pdev->ctx->stack;
+ pdf14_buf *buf;
+ int code;
+
+ /* Check if a context stack is set */
+ if (pdev->ctx->stack == NULL) {
+ code = pdf14_initialize_ctx(dev, dev->color_info.num_components,
+ dev->color_info.polarity != GX_CINFO_POLARITY_SUBTRACTIVE);
+ if (code < 0)
+ return code;
+ }
+ buf = pdev->ctx->stack;
fit_fill_xywh(dev, x, y, w, h);
if (w <= 0 || h <= 0)