]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
imagetoraster, imagetopdf: Fixed print-scaling=auto
authorTill Kamppeter <till.kamppeter@gmail.com>
Thu, 17 Feb 2022 16:56:16 +0000 (17:56 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Thu, 17 Feb 2022 16:56:16 +0000 (17:56 +0100)
In the imageto... filters with print-scaling=auto the image size was
not compared correctly with the page size to switch between
fit-to-page for large sizes and no scaling for small sizes. The image
size in pixels was compared with the page size in PostScript points
(1/72 inch).

This commit fixes the comparisons.

(manually backported from commit df3b19756dc2c76a0b0cb2fd4ea45a397167af7f)

filter/imagetopdf.c
filter/imagetoraster.c

index 8884b68d7c6e144afb23dd44ab3f90c1d563791c..5355746aa5a9c934a0769a1a32641c861e82beab 100644 (file)
@@ -1000,9 +1000,8 @@ main(int  argc,                           /* I - Number of command-line arguments */
     pw = ph;
     ph = tmp;
   }
-  if(w>pw||h>ph) {
+  if (w * 72.0 / img->xppi > pw || h * 72.0 / img->yppi > ph)
     document_large = 1;
-  }
 
   if((val = cupsGetOption("print-scaling",num_options,options)) != NULL) {
     if(!strcasecmp(val,"auto")) {
index 4c3bf069e8e98bc7515ceb38c308898ae9329a24..fcc6cb1efda5522df30aa64ac8095d0320e96a7b 100644 (file)
@@ -665,10 +665,8 @@ main(int  argc,                            /* I - Number of command-line arguments */
     pw = ph;
     ph = tmp;
   }
-  if(w>pw||h>ph)
-  {
+  if (w * 72.0 / img->xppi > pw || h * 72.0 / img->yppi > ph)
     document_large = 1;
-  }
 
   if((val = cupsGetOption("print-scaling",num_options,options)) != NULL)
   {