summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gilbert <david.gilbert@object-refinery.com>2006-09-04 08:52:32 +0000
committerDavid Gilbert <david.gilbert@object-refinery.com>2006-09-04 08:52:32 +0000
commitfb8f4e7202ad4e3757a7e689ac3c96b8f57f0732 (patch)
tree85a14f320f1c80a032cc7298a466f5418306c8fc
parentcd7581946c7aa6c94611ce57083e25d47e246918 (diff)
downloadclasspath-fb8f4e7202ad4e3757a7e689ac3c96b8f57f0732.tar.gz
2006-09-04 David Gilbert <david.gilbert@object-refinery.com>
* java/awt/Rectangle.java (setRect(double, double, double, double)): Modified rounding of input values.
-rw-r--r--ChangeLog6
-rw-r--r--java/awt/Rectangle.java16
2 files changed, 15 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index ea695bbbe..f61c83ae7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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;
}
/**