6696292: Printing transformed images accuracy problems
Reviewed-by: jgodinez, igor
--- a/jdk/src/share/classes/sun/print/PSPathGraphics.java Tue May 13 16:18:30 2008 -0700
+++ b/jdk/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/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java Tue May 13 16:18:30 2008 -0700
+++ b/jdk/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.