Hi,

This patch removes rounding in pixel shifting. Originally this code floor()'ed pixel values before shifting them; a while ago, I changed it to round() due to some accuracy errors.

Further investigation has revealed the underlying problem to be inaccurate float -> double casting. Rounding still seems to be causing problems, however, and it looks like the benefits of rounding don't outweigh the costs.

Cheers,
Francis


2006-12-22  Francis Kung  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/CairoGraphics2D.java
        (shiftX): Remove rounding.
        (shiftY): Likewise.

### Eclipse Workspace Patch 1.0
#P classpath
Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v
retrieving revision 1.60
diff -u -r1.60 CairoGraphics2D.java
--- gnu/java/awt/peer/gtk/CairoGraphics2D.java	22 Dec 2006 19:50:30 -0000	1.60
+++ gnu/java/awt/peer/gtk/CairoGraphics2D.java	22 Dec 2006 19:55:43 -0000
@@ -1913,7 +1913,7 @@
         double shift = 0.5;
         if (!transform.isIdentity())
           shift /= transform.getScaleX();
-        return Math.round(coord) + shift;
+        return (coord + shift);
       }
     else
       return coord;
@@ -1929,7 +1929,7 @@
         double shift = 0.5;
         if (!transform.isIdentity())
           shift /= transform.getScaleY();
-        return Math.round(coord) + shift;
+        return (coord + shift);
       }
     else
       return coord;

Reply via email to