]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix asymmetric resolution bug, address unit test issues.
authorMichael Sweet <michael.r.sweet@gmail.com>
Wed, 14 Dec 2016 14:01:18 +0000 (09:01 -0500)
committerMichael Sweet <michael.r.sweet@gmail.com>
Wed, 14 Dec 2016 14:01:18 +0000 (09:01 -0500)
doc/help/api-httpipp.html
doc/help/api-raster.html
filter/raster.c
filter/testraster.c

index a19850e7a75e7271a494ec74ac33bb954ee33bc0..ba5a86bea13bee13ff352e3c221595522096a715 100644 (file)
@@ -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>
index 28d1708ad744f14f0f5571800bcf74b38b7e50bd..cd0afd14abde2b5b13c42f4b59cbd378cf9603e2 100644 (file)
@@ -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">&nbsp;CUPS 1.3/macOS 10.5&nbsp;</span></dt>
 <dd class="description">Open stream for compressed writing </dd>
 <dt>CUPS_RASTER_WRITE_PWG <span class="info">&nbsp;CUPS 1.5/macOS 10.7&nbsp;</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>
index 8db78302779fbc2cdea17800e84be910dee3699b..febc0400b7f3d19e9486cfc3dddb21d18b4ae177 100644 (file)
@@ -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;
 
        /*
index 112876d98966f50dd120b51915823bf4719674e0..d3482186dc141c8aacba3b0c62be2fd80e90f9cf 100644 (file)
@@ -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)
     {