diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | java/awt/Rectangle.java | 16 |
2 files changed, 15 insertions, 7 deletions
@@ -1,3 +1,9 @@ +2006-09-04 David Gilbert <david.gilbert@object-refinery.com> + + * java/awt/Rectangle.java + (setRect(double, double, double, double)): Modified rounding of input + values. + 2006-09-03 Audrius Meskauskas <AudriusA@Bioinformatics.org> * gnu/javax/swing/text/html/parser/HTML_401F.java (defineElements): diff --git a/java/awt/Rectangle.java b/java/awt/Rectangle.java index c4ba6ba14..47c51b60b 100644 --- a/java/awt/Rectangle.java +++ b/java/awt/Rectangle.java @@ -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 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable } /** - * 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 class Rectangle extends Rectangle2D implements Shape, Serializable */ 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; } /** |