[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: fixes for Arc2D

Kaffe CVS cvs-commits at kaffe.org
Wed Nov 24 20:33:33 PST 2004


PatchSet 5483 
Date: 2004/11/25 04:15:45
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: fixes for Arc2D

2004-11-24  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/awt/geom/Arc2D.java:
        Resynced with GNU Classpath.

        2004-11-17  Sven de Marothy  <sven at physto.se>

        * java/awt/geom/Arc2D.java,
        (setAngleStart): Corrected (wrong sign on atan2 y parameter)
        (setAngles): Likewise
        (containsAngle): Return false on zero extent, don't include final angle
        (contains): Treat OPEN-type arcs like CHORD ones, not as PIE ones.

Members: 
	ChangeLog:1.3029->1.3030 
	libraries/javalib/java/awt/geom/Arc2D.java:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3029 kaffe/ChangeLog:1.3030
--- kaffe/ChangeLog:1.3029	Thu Nov 25 03:59:55 2004
+++ kaffe/ChangeLog	Thu Nov 25 04:15:45 2004
@@ -1,5 +1,18 @@
 2004-11-24  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/awt/geom/Arc2D.java:
+        Resynced with GNU Classpath.
+
+	2004-11-17  Sven de Marothy  <sven at physto.se>
+
+        * java/awt/geom/Arc2D.java,
+        (setAngleStart): Corrected (wrong sign on atan2 y parameter)
+        (setAngles): Likewise
+        (containsAngle): Return false on zero extent, don't include final angle
+        (contains): Treat OPEN-type arcs like CHORD ones, not as PIE ones.
+
+2004-11-24  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/awt/geom/AffineTransform.java:
         Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/java/awt/geom/Arc2D.java
diff -u kaffe/libraries/javalib/java/awt/geom/Arc2D.java:1.7 kaffe/libraries/javalib/java/awt/geom/Arc2D.java:1.8
--- kaffe/libraries/javalib/java/awt/geom/Arc2D.java:1.7	Wed Nov 24 21:49:20 2004
+++ kaffe/libraries/javalib/java/awt/geom/Arc2D.java	Thu Nov 25 04:15:48 2004
@@ -327,7 +327,7 @@
     // Normalize.
     double x = p.getX() - (getX() + getWidth() / 2);
     double y = p.getY() - (getY() + getHeight() / 2);
-    setAngleStart(Math.toDegrees(Math.atan2(y, x)));
+    setAngleStart(Math.toDegrees(Math.atan2(-y, x)));
   }
 
   /**
@@ -352,8 +352,8 @@
     y1 = y1 - (my + mh / 2);
     x2 = x2 - (mx + mw / 2);
     y2 = y2 - (my + mh / 2);
-    double start = Math.toDegrees(Math.atan2(y1, x1));
-    double extent = Math.toDegrees(Math.atan2(y2, x2)) - start;
+    double start = Math.toDegrees(Math.atan2(-y1, x1));
+    double extent = Math.toDegrees(Math.atan2(-y2, x2)) - start;
     if (extent < 0)
       extent += 360;
     setAngleStart(start);
@@ -469,6 +469,9 @@
     double extent = getAngleExtent();
     double end = start + extent;
 
+    if (extent == 0)
+      return false;
+
     if (extent >= 360 || extent <= -360)
       return true;
 
@@ -490,7 +493,7 @@
     while (a < start)
       a += 360;
 
-    return a >= start && a <= end;
+    return a >= start && a < end; // starting angle included, ending angle not
   }
 
   /**
@@ -498,7 +501,7 @@
    * is empty, then this will return false.
    *
    * The area considered 'inside' an arc of type OPEN is the same as the
-   * area inside an equivalent filled PIE-type arc. The area considered
+   * area inside an equivalent filled CHORD-type arc. The area considered
    * 'inside' a CHORD-type arc is the same as the filled area.
    *
    * @param x the x coordinate to test
@@ -521,7 +524,7 @@
       return false;
 
     double angle = Math.toDegrees(Math.atan2(-dy, dx));
-    if (getArcType() != CHORD)
+    if (getArcType() == PIE)
       return containsAngle(angle);
 
     double a1 = Math.toRadians(getAngleStart());




More information about the kaffe mailing list