This patch (committed) changes the rounding used in the setRect() method:

2006-09-04  David Gilbert  <[EMAIL PROTECTED]>

        * java/awt/Rectangle.java
        (setRect(double, double, double, double)): Modified rounding of input
        values.

I have Mauve tests for this and will commit them in a moment...

Regards,

Dave
Index: java/awt/Rectangle.java
===================================================================
RCS file: /sources/classpath/classpath/java/awt/Rectangle.java,v
retrieving revision 1.16
diff -u -r1.16 Rectangle.java
--- java/awt/Rectangle.java     16 Sep 2005 01:11:39 -0000      1.16
+++ java/awt/Rectangle.java     4 Sep 2006 08:49:49 -0000
@@ -1,5 +1,5 @@
 /* Rectangle.java -- represents a graphics rectangle
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
+   Copyright (C) 1999, 2000, 2001, 2002, 2006, Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -299,8 +299,10 @@
   }
 
   /**
-   * Updates this rectangle to have the specified dimensions, as rounded to
-   * integers.
+   * Updates this rectangle to have the specified dimensions, rounded to the
+   * integer precision used by this class (the values are rounded "outwards" so
+   * that the stored rectangle completely encloses the specified double 
+   * precision rectangle).
    *
    * @param x the new X coordinate of the upper left hand corner
    * @param y the new Y coordinate of the upper left hand corner
@@ -310,10 +312,10 @@
    */
   public void setRect(double x, double y, double width, double height)
   {
-    this.x = (int) x;
-    this.y = (int) y;
-    this.width = (int) width;
-    this.height = (int) height;
+    this.x = (int) Math.floor(x);
+    this.y = (int) Math.floor(y);
+    this.width = (int) Math.ceil(x + width) - this.x;
+    this.height = (int) Math.ceil(y + height) - this.y;
   }
 
   /**

Reply via email to