[gs-commits] rev 11826 - trunk/gs/base

robin at ghostscript.com robin at ghostscript.com
Wed Oct 20 10:59:24 UTC 2010


Author: robin
Date: 2010-10-20 10:59:23 +0000 (Wed, 20 Oct 2010)
New Revision: 11826

Modified:
   trunk/gs/base/gxclimag.c
Log:
Disable the use of high level images in the clist if we are downscaling;
this serves 2 purposes.

Firstly, it fixes the potential problems with banded/unbanded mismatch
of rendering due to the 'support' calculations done in the high level image
code. These calculations are no longer correct for downscales since the
change to use a simpler interpolated image scaler.

Secondly, when downscaling we will probably end up copying more data than
we would if we just kept the original, so high level images are a bad idea
anyway.

This *should* produce no differences, but actually produces lots.

Most of these might be ignorable (slight rendering differences that appear to
result in the new images being a little lighter, but a significant number
appear to be noticable progressions, which hints that the high level image
clist code is broken. Specifically high level images fail to  render the
same as the non high level code does. In particular halftoning seems to
be enabled for some examples when high level images are used, for no good
reason. This has been opened as bug 691697.




Modified: trunk/gs/base/gxclimag.c
===================================================================
--- trunk/gs/base/gxclimag.c	2010-10-20 10:21:50 UTC (rev 11825)
+++ trunk/gs/base/gxclimag.c	2010-10-20 10:59:23 UTC (rev 11826)
@@ -299,8 +299,17 @@
     /* Don't band if the matrix is (nearly) singular. */
     if (fabs(pmat->xx * pmat->yy - pmat->xy * pmat->yx) < 0.001)
         return false;
-    if (is_xxyy(pmat) || is_xyyx(pmat))
-        return true;
+    /* If it's portrait, then we encode it if not a downscale */
+    if (is_xxyy(pmat))
+        return (fabs(pmat->xx) >= 1) && (fabs(pmat->yy) >= 1);
+    /* If it's landscape, then we encode it if not a downscale */
+    if (is_xyyx(pmat))
+        return (fabs(pmat->xy) >= 1) && (fabs(pmat->yx) >= 1);
+    /* Skewed, so do more expensive downscale test */
+    if ((pmat->xx * pmat->xx + pmat->xy * pmat->xy < 1.0) ||
+        (pmat->yx * pmat->yx + pmat->yy * pmat->yy < 1.0))
+        return false;
+    /* Otherwise only encode it if it doesn't rotate too much */
     t = (fabs(pmat->xx) + fabs(pmat->yy)) /
         (fabs(pmat->xy) + fabs(pmat->yx));
     return (t < 0.2 || t > 5);



More information about the gs-commits mailing list