changeset 320:57bcfeb3d8d8

6696292: Printing transformed images accuracy problems Reviewed-by: jgodinez, igor
author prr
date Tue, 13 May 2008 16:49:21 -0700
parents fb61ff1cc5fd
children 4092c04aeae7
files src/share/classes/sun/print/PSPathGraphics.java src/windows/classes/sun/awt/windows/WPathGraphics.java
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/print/PSPathGraphics.java	Tue May 13 16:18:30 2008 -0700
+++ b/src/share/classes/sun/print/PSPathGraphics.java	Tue May 13 16:49:21 2008 -0700
@@ -344,8 +344,15 @@
         double devScaleX = devResX / DEFAULT_USER_RES;
         double devScaleY = devResY / DEFAULT_USER_RES;
 
-        if (scaleX > devScaleX) scaleX = devScaleX;
-        if (scaleY > devScaleY) scaleY = devScaleY;
+        /* check if rotated or sheared */
+        int transformType = fullTransform.getType();
+        boolean clampScale = ((transformType &
+                               (AffineTransform.TYPE_GENERAL_ROTATION |
+                                AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0);
+        if (clampScale) {
+            if (scaleX > devScaleX) scaleX = devScaleX;
+            if (scaleY > devScaleY) scaleY = devScaleY;
+        }
 
         /* We do not need to draw anything if either scaling
          * factor is zero.
--- a/src/windows/classes/sun/awt/windows/WPathGraphics.java	Tue May 13 16:18:30 2008 -0700
+++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java	Tue May 13 16:49:21 2008 -0700
@@ -943,8 +943,16 @@
         double devResY = wPrinterJob.getYRes();
         double devScaleX = devResX / DEFAULT_USER_RES;
         double devScaleY = devResY / DEFAULT_USER_RES;
-        if (scaleX > devScaleX) scaleX = devScaleX;
-        if (scaleY > devScaleY) scaleY = devScaleY;
+
+        /* check if rotated or sheared */
+        int transformType = fullTransform.getType();
+        boolean clampScale = ((transformType &
+                               (AffineTransform.TYPE_GENERAL_ROTATION |
+                                AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0);
+        if (clampScale) {
+            if (scaleX > devScaleX) scaleX = devScaleX;
+            if (scaleY > devScaleY) scaleY = devScaleY;
+        }
 
         /* We do not need to draw anything if either scaling
          * factor is zero.