diff options
author | Michael Sweet <michael.r.sweet@gmail.com> | 2016-12-14 09:01:18 -0500 |
---|---|---|
committer | Michael Sweet <michael.r.sweet@gmail.com> | 2016-12-14 09:01:18 -0500 |
commit | 073e58a9fb9a1b6a76961413d01f03407f37c4a6 (patch) | |
tree | e1c6c65871399c9b8f941c8abc9da0b29dafe872 | |
parent | 49c5929363cbbefcf6a91501fc5e632c0708e3a6 (diff) |
Fix asymmetric resolution bug, address unit test issues.
-rw-r--r-- | doc/help/api-httpipp.html | 10 | ||||
-rw-r--r-- | doc/help/api-raster.html | 4 | ||||
-rw-r--r-- | filter/raster.c | 21 | ||||
-rw-r--r-- | filter/testraster.c | 16 |
4 files changed, 44 insertions, 7 deletions
diff --git a/doc/help/api-httpipp.html b/doc/help/api-httpipp.html index a19850e7a..ba5a86bea 100644 --- a/doc/help/api-httpipp.html +++ b/doc/help/api-httpipp.html @@ -6201,6 +6201,8 @@ are server-oriented...</p> <dd class="description">Accordian-fold the paper vertically into four sections</dd> <dt>IPP_FINISHINGS_FOLD_DOUBLE_GATE </dt> <dd class="description">Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically</dd> +<dt>IPP_FINISHINGS_FOLD_ENGINEERING_Z </dt> +<dd class="description">Fold the paper vertically into two small sections and one larger, forming an elongated Z</dd> <dt>IPP_FINISHINGS_FOLD_GATE </dt> <dd class="description">Fold the top and bottom quarters of the paper towards the midline</dd> <dt>IPP_FINISHINGS_FOLD_HALF </dt> @@ -6239,6 +6241,14 @@ are server-oriented...</p> <dd class="description">Punch 2 holes right side</dd> <dt>IPP_FINISHINGS_PUNCH_DUAL_TOP </dt> <dd class="description">Punch 2 holes top edge</dd> +<dt>IPP_FINISHINGS_PUNCH_MULTIPLE_BOTTOM </dt> +<dd class="description">Pucnh multiple holes bottom edge</dd> +<dt>IPP_FINISHINGS_PUNCH_MULTIPLE_LEFT </dt> +<dd class="description">Pucnh multiple holes left side</dd> +<dt>IPP_FINISHINGS_PUNCH_MULTIPLE_RIGHT </dt> +<dd class="description">Pucnh multiple holes right side</dd> +<dt>IPP_FINISHINGS_PUNCH_MULTIPLE_TOP </dt> +<dd class="description">Pucnh multiple holes top edge</dd> <dt>IPP_FINISHINGS_PUNCH_QUAD_BOTTOM </dt> <dd class="description">Punch 4 holes bottom edge</dd> <dt>IPP_FINISHINGS_PUNCH_QUAD_LEFT </dt> diff --git a/doc/help/api-raster.html b/doc/help/api-raster.html index 28d1708ad..cd0afd14a 100644 --- a/doc/help/api-raster.html +++ b/doc/help/api-raster.html @@ -875,7 +875,7 @@ unsigned cupsRasterWriteHeader2 (<br> <h4 class="returnvalue">Return Value</h4> <p class="description">1 on success, 0 on failure</p> <h4 class="discussion">Discussion</h4> -<p class="discussion">The page header can be initialized using <a href="#cupsRasterInterpretPPD"><code>cupsRasterInterpretPPD</code></a>. +<p class="discussion">The page header can be initialized using <a href="#cupsRasterInitPWGHeader"><code>cupsRasterInitPWGHeader</code></a>. </p> <h3 class="function"><a name="cupsRasterWritePixels">cupsRasterWritePixels</a></h3> @@ -1438,7 +1438,7 @@ factor not applied) </dd> <dt>CUPS_RASTER_WRITE_COMPRESSED <span class="info"> CUPS 1.3/macOS 10.5 </span></dt> <dd class="description">Open stream for compressed writing </dd> <dt>CUPS_RASTER_WRITE_PWG <span class="info"> CUPS 1.5/macOS 10.7 </span></dt> -<dd class="description">Open stream for compressed writing in PWG mode </dd> +<dd class="description">Open stream for compressed writing in PWG Raster mode </dd> </dl> <h3 class="enumeration"><a name="cups_order_e">cups_order_e</a></h3> <p class="description">cupsColorOrder attribute values</p> diff --git a/filter/raster.c b/filter/raster.c index 8db783027..febc0400b 100644 --- a/filter/raster.c +++ b/filter/raster.c @@ -36,7 +36,8 @@ struct _cups_raster_s /**** Raster stream data ****/ cups_raster_iocb_t iocb; /* IO callback */ cups_mode_t mode; /* Read/write mode */ cups_page_header2_t header; /* Raster header for current page */ - unsigned count, /* Current row run-length count */ + unsigned rowheight, /* Row height in lines */ + count, /* Current row run-length count */ remaining, /* Remaining rows in page image */ bpp; /* Bytes per pixel/color */ unsigned char *pixels, /* Pixels for current row */ @@ -1008,7 +1009,7 @@ cupsRasterWriteHeader( * 'cupsRasterWriteHeader2()' - Write a raster page header from a version 2 * page header structure. * - * The page header can be initialized using @link cupsRasterInterpretPPD@. + * The page header can be initialized using @link cupsRasterInitPWGHeader@. * * @since CUPS 1.2/macOS 10.5@ */ @@ -1031,6 +1032,16 @@ cupsRasterWriteHeader2( if (!cups_raster_update(r)) return (0); + if (r->mode == CUPS_RASTER_WRITE_APPLE) + { + r->rowheight = h->HWResolution[0] / h->HWResolution[1]; + + if (h->HWResolution[0] != (r->rowheight * h->HWResolution[1])) + return (0); + } + else + r->rowheight = 1; + /* * Write the raster header... */ @@ -1277,7 +1288,7 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */ * Increase the repeat count... */ - r->count ++; + r->count += r->rowheight; r->pcurrent = r->pixels; /* @@ -1293,7 +1304,7 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */ else return (len); } - else if (r->count == 256) + else if (r->count > (256 - r->rowheight)) { if (cups_raster_write(r, r->pixels) <= 0) return (0); @@ -1322,7 +1333,7 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */ * Increase the repeat count... */ - r->count ++; + r->count += r->rowheight; r->pcurrent = r->pixels; /* diff --git a/filter/testraster.c b/filter/testraster.c index 112876d98..d3482186d 100644 --- a/filter/testraster.c +++ b/filter/testraster.c @@ -553,6 +553,12 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */ header.cupsWidth = 256; header.cupsHeight = 256; header.cupsBytesPerLine = 256; + header.HWResolution[0] = 64; + header.HWResolution[1] = 64; + header.PageSize[0] = 288; + header.PageSize[1] = 288; + header.cupsPageSize[0] = 288.0f; + header.cupsPageSize[1] = 288.0f; if (page & 1) { @@ -679,6 +685,16 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */ expected.cupsWidth = 256; expected.cupsHeight = 256; expected.cupsBytesPerLine = 256; + expected.HWResolution[0] = 64; + expected.HWResolution[1] = 64; + expected.PageSize[0] = 288; + expected.PageSize[1] = 288; + + if (mode != CUPS_RASTER_WRITE_PWG) + { + expected.cupsPageSize[0] = 288.0f; + expected.cupsPageSize[1] = 288.0f; + } if (mode >= CUPS_RASTER_WRITE_PWG) { |