summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2017-08-06 12:24:21 -0700
committerRay Johnston <ray.johnston@artifex.com>2017-08-06 21:09:09 -0700
commit478a0a862d2593199bcae599e46bdc97b525bb12 (patch)
tree71c2a8012fcec5973c8e43b6fe09785b1b87375d
parentd91d4273f38fb8a527ff342d360cee8aaf468896 (diff)
downloadghostpdl-478a0a862d2593199bcae599e46bdc97b525bb12.tar.gz
Bug 698334: LeadingEdge parameter problems.
Because -dLeadingEdge=# sets the value in systemdict, we need to return this parameter from gx_default_get_param and gx_default_get_params so that the systemdict value will get sent to the device (putdeviceprops). Also found that the JPEG device was using LeadingEdge, but not stripping off the "LEADINGEDGE_SET" bit. Fix by anding with LEADINGEDGE_MASK. Lastly, the cups device put_params needs to be able to accept a null parameter type as the default put_params can.
-rw-r--r--base/gsdparam.c6
-rw-r--r--cups/gdevcups.c22
-rw-r--r--devices/gdevjpeg.c2
3 files changed, 26 insertions, 4 deletions
diff --git a/base/gsdparam.c b/base/gsdparam.c
index 159b9a277..31935f54d 100644
--- a/base/gsdparam.c
+++ b/base/gsdparam.c
@@ -243,7 +243,8 @@ int gx_default_get_param(gx_device *dev, char *Param, void *list)
if (dev->LeadingEdge & LEADINGEDGE_SET_MASK) {
int leadingedge = dev->LeadingEdge & LEADINGEDGE_MASK;
return param_write_int(plist, "LeadingEdge", &leadingedge);
- }
+ } else
+ return param_write_null(plist, "LeadingEdge");
}
if (dev->color_info.num_components > 1) {
@@ -712,7 +713,8 @@ gx_default_get_params(gx_device * dev, gs_param_list * plist)
if (dev->LeadingEdge & LEADINGEDGE_SET_MASK) {
int leadingedge = dev->LeadingEdge & LEADINGEDGE_MASK;
code = param_write_int(plist, "LeadingEdge", &leadingedge);
- }
+ } else
+ code = param_write_null(plist, "LeadingEdge");
if (code < 0)
return code;
diff --git a/cups/gdevcups.c b/cups/gdevcups.c
index a6c3f7fa8..f596d3fe2 100644
--- a/cups/gdevcups.c
+++ b/cups/gdevcups.c
@@ -3218,7 +3218,6 @@ cups_put_params(gx_device *pdev, /* I - Device info */
arrayoption(ImagingBoundingBox, "ImagingBoundingBox", 4)
booloption(InsertSheet, "InsertSheet")
intoption(Jog, "Jog", cups_jog_t)
- intoption(LeadingEdge, "LeadingEdge", cups_edge_t)
arrayoption(Margins, "Margins", 2)
booloption(ManualFeed, "ManualFeed")
intoption(MediaPosition, "cupsMediaPosition", unsigned) /* Compatibility */
@@ -3240,6 +3239,27 @@ 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
+
#ifdef GX_COLOR_INDEX_TYPE
/*
* Support cupsPreferredBitsPerColor - basically, allows you to
diff --git a/devices/gdevjpeg.c b/devices/gdevjpeg.c
index dce907d6a..193fbc873 100644
--- a/devices/gdevjpeg.c
+++ b/devices/gdevjpeg.c
@@ -374,7 +374,7 @@ jpeg_get_initial_matrix(gx_device *dev, gs_matrix *pmat)
/* NB this device has no paper margins */
- switch(pdev->LeadingEdge) {
+ switch(pdev->LeadingEdge & LEADINGEDGE_MASK) {
case 1:
pmat->xx = 0;
pmat->xy = -ss_res;