Skip to content

Commit 545a049

Browse files
committed
Further fixes in handling resolutions
- cfRasterPrepareHeader(): When taking default resolution from "urf-supported" printer IPP attribute, use first value (lowest) of the list, to match the ppdLoadAttributes() function of libppd. - raster_base_header(): If no resolution is specified as job IPP attribute or in the options list, use the default resolution from the printer IPP attributes.
1 parent 9687ebf commit 545a049

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

cupsfilters/ipp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ cfIPPAttrResolutionForPrinter(ipp_t *printer_attrs,// I - Printer attributes
885885
attr_name = "printer-resolution";
886886

887887
// Check whether job got supplied the named attribute and read out its value
888-
// as integer
888+
// as resolution
889889
if (job_attrs == NULL ||
890890
(attr = ippFindAttribute(job_attrs, attr_name, IPP_TAG_ZERO)) == NULL)
891891
retval = 0;

cupsfilters/raster.c

+6-11
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,10 @@ cfRasterPrepareHeader(cups_page_header2_t *h, // I - Raster header
294294
const char *p = ippGetString(attr, i, NULL);
295295
if (strncasecmp(p, "RS", 2))
296296
continue;
297-
int lo; int hi;
298-
lo = atoi(p + 2);
299-
if (lo == 0)
300-
lo = -1;
301-
p = strchr(p, '-');
302-
if (p)
303-
hi = atoi(p + 1);
304-
else
305-
hi = lo;
306-
xres = hi;
307-
yres = hi;
297+
int res;
298+
res = atoi(p + 2);
299+
if (res > 0)
300+
xres = yres = res;
308301
}
309302
}
310303
}
@@ -1074,6 +1067,8 @@ raster_base_header(cups_page_header2_t *h, // O - Raster header
10741067
cfIPPAttrResolutionForPrinter(data->printer_attrs, attrs, NULL, &x, &y);
10751068
ippDelete(attrs);
10761069
}
1070+
else
1071+
cfIPPAttrResolutionForPrinter(data->printer_attrs, NULL, NULL, &x, &y);
10771072
if (x && y)
10781073
{
10791074
h->HWResolution[0] = x;

0 commit comments

Comments
 (0)