]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Fixed imageto...() with print-scaling=auto
authorTill Kamppeter <till.kamppeter@gmail.com>
Thu, 17 Feb 2022 14:41:50 +0000 (15:41 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Thu, 17 Feb 2022 14:41:50 +0000 (15:41 +0100)
In the imageto...() filter functions 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.

cupsfilters/imagetopdf.c
cupsfilters/imagetops.c
cupsfilters/imagetoraster.c

index 7542ed108ff447d1f519bceb4f5318b37265956d..08e4a6c6f4be93e46283481ee94b73dce5f6e5cb 100644 (file)
@@ -1217,9 +1217,8 @@ imagetopdf(int inputfd,         /* I - File descriptor input stream */
     pw = ph;
     ph = tmp;
   }
-  if(w>pw||h>ph) {
+  if (w * 72.0 / doc.img->xppi > pw || h * 72.0 / doc.img->yppi > ph)
     document_large = 1;
-  }
 
   if((val = cupsGetOption("print-scaling",num_options,options)) != NULL) {
     if(!strcasecmp(val,"auto")) {
index 2ab40a144edaa4dbe0181f8626c305801cd911c1..1c7bdcd58a4e9e83eb0be04974e446558245c6ba 100644 (file)
@@ -483,7 +483,7 @@ imagetops(int inputfd,         /* I - File descriptor input stream */
       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)
index 5405285002abe10c98b5a613eee0e703ccfb7235..f1fd81a52bb60323d94eefa87b88f05df2657b64 100644 (file)
@@ -937,10 +937,8 @@ imagetoraster(int inputfd,         /* I - File descriptor input stream */
     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)
   {