summaryrefslogtreecommitdiff
path: root/cups
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2018-10-23 13:40:14 +0100
committerChris Liddell <chris.liddell@artifex.com>2018-10-23 16:01:41 +0100
commit73f7c6eb92596087a1e30123ba0cdf701f8d6006 (patch)
tree834368893e64deedfbec351eb798e02ac0d35584 /cups
parent8e18fcdaa2e2247363c4cc8f851f3096cc5756fa (diff)
downloadghostpdl-73f7c6eb92596087a1e30123ba0cdf701f8d6006.tar.gz
Bug 700023: Fix cups get/put_params LeadingEdge logic
Custom device LeadingEdge logic in complicated as it potentially requires equivalent changes to changing the page size. For a device like cups which merely wants the LeadingEdge value stored in its own place it makes much more sense to allow the Ghostscript 'core' to handle all the logic (which it has to do anyway to ensure the rendering is correct), and then just copy the value into the cups specific place. This saves the problem, as in this case, of unexpectedly ending up with two LeadingEdge parameters being included in a call to put_params.
Diffstat (limited to 'cups')
-rw-r--r--cups/gdevcups.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/cups/gdevcups.c b/cups/gdevcups.c
index decd8eb35..bd699fc27 100644
--- a/cups/gdevcups.c
+++ b/cups/gdevcups.c
@@ -1016,10 +1016,6 @@ cups_get_params(gx_device *pdev, /* I - Device info */
(int *)&(cups->header.Jog))) < 0)
goto done;
- if ((code = param_write_int(plist, "LeadingEdge",
- (int *)&(cups->header.LeadingEdge))) < 0)
- goto done;
-
b = cups->header.ManualFeed;
if ((code = param_write_bool(plist, "ManualFeed", &b)) < 0)
goto done;
@@ -2838,6 +2834,9 @@ cups_open(gx_device *pdev) /* I - Device info */
return(code);
}
+ /* Establish the default LeadingEdge in the cups header */
+ cups->header.LeadingEdge = (cups_edge_t)(pdev->LeadingEdge & LEADINGEDGE_MASK);
+
if ((code = gdev_prn_open(pdev)) != 0)
return(code);
@@ -3241,23 +3240,6 @@ cups_put_params(gx_device *pdev, /* I - Device info */
intoption(cupsRowFeed, "cupsRowFeed", unsigned)
intoption(cupsRowStep, "cupsRowStep", unsigned)
- /* Special handling of LeadingEdge to allow null as a valid value type */
- if ((code = param_read_int(plist, "LeadingEdge", &intval)) < 0)
- {
- if ((code = param_read_null(plist, "LeadingEdge")) < 0)
- {
- dmprintf(pdev->memory, "ERROR: Error setting LeadingEdge ...\n");
- param_signal_error(plist, "LeadingEdge", code);
- goto done;
- }
- if (code == 0)
- cups->header.LeadingEdge = CUPS_EDGE_TOP;
- }
- else if (code == 0)
- {
- cups->header.LeadingEdge = (cups_edge_t)intval;
- }
-
#ifdef GX_COLOR_INDEX_TYPE
/*
* Support cupsPreferredBitsPerColor - basically, allows you to
@@ -3316,6 +3298,8 @@ cups_put_params(gx_device *pdev, /* I - Device info */
if ((code = gdev_prn_put_params(pdev, plist)) < 0)
goto done;
+ cups->header.LeadingEdge = (cups_edge_t)(pdev->LeadingEdge & LEADINGEDGE_MASK);
+
/* If cups_set_color_info() changed the color model of the device we want to
* force the raster memory to be recreated/reinitialized
*/