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

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


PatchSet 5482 
Date: 2004/11/25 04:00:02
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: fixes for AffineTransform

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

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

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

        * java/awt/geom/AffineTransform.java,
        (inverseTransform): Fixed bug and simplified code.
        (createTransformedShape): Return null on null parameter.

Members: 
	libraries/javalib/java/awt/geom/AffineTransform.java:1.4->1.5 
	ChangeLog:1.3028->1.3029 

Index: kaffe/libraries/javalib/java/awt/geom/AffineTransform.java
diff -u kaffe/libraries/javalib/java/awt/geom/AffineTransform.java:1.4 kaffe/libraries/javalib/java/awt/geom/AffineTransform.java:1.5
--- kaffe/libraries/javalib/java/awt/geom/AffineTransform.java:1.4	Mon Oct  4 13:32:33 2004
+++ kaffe/libraries/javalib/java/awt/geom/AffineTransform.java	Thu Nov 25 04:00:02 2004
@@ -1234,17 +1234,7 @@
   public Point2D inverseTransform(Point2D src, Point2D dst)
     throws NoninvertibleTransformException
   {
-    double det = getDeterminant();
-    if (det == 0)
-      throw new NoninvertibleTransformException("couldn't invert transform");
-    if (dst == null)
-      dst = new Point2D.Double();
-    double x = src.getX();
-    double y = src.getY();
-    double nx = (m11 * x + -m10 * y) / det - m02;
-    double ny = (m01 * x + -m00 * y) / det - m12;
-    dst.setLocation(nx, ny);
-    return dst;
+    return createInverse().transform(src, dst);
   }
 
   /**
@@ -1268,23 +1258,7 @@
                                double[] dstPts, int dstOff, int num)
     throws NoninvertibleTransformException
   {
-    double det = getDeterminant();
-    if (det == 0)
-      throw new NoninvertibleTransformException("couldn't invert transform");
-    if (srcPts == dstPts && dstOff > srcOff
-        && num > 1 && srcOff + 2 * num > dstOff)
-      {
-        double[] d = new double[2 * num];
-        System.arraycopy(srcPts, srcOff, d, 0, 2 * num);
-        srcPts = d;
-      }
-    while (--num >= 0)
-      {
-        double x = srcPts[srcOff++];
-        double y = srcPts[srcOff++];
-        dstPts[dstOff++] = (m11 * x + -m10 * y) / det - m02;
-        dstPts[dstOff++] = (m01 * x + -m00 * y) / det - m12;
-      }
+    createInverse().transform(srcPts, srcOff, dstPts, dstOff, num);
   }
 
   /**
@@ -1359,12 +1333,14 @@
    * which only stores points in float precision.
    *
    * @param src the shape source to transform
-   * @return the shape, transformed by this
-   * @throws NullPointerException if src is null
+   * @return the shape, transformed by this, <code>null</code> if src is 
+   * <code>null</code>.
    * @see GeneralPath#transform(AffineTransform)
    */
   public Shape createTransformedShape(Shape src)
   {
+    if(src == null) 
+      return null;
     GeneralPath p = new GeneralPath(src);
     p.transform(this);
     return p;
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3028 kaffe/ChangeLog:1.3029
--- kaffe/ChangeLog:1.3028	Thu Nov 25 03:46:32 2004
+++ kaffe/ChangeLog	Thu Nov 25 03:59:55 2004
@@ -1,5 +1,16 @@
 2004-11-24  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/awt/geom/AffineTransform.java:
+        Resynced with GNU Classpath.
+
+	2004-11-16  Sven de Marothy  <sven at physto.se>
+
+        * java/awt/geom/AffineTransform.java,
+        (inverseTransform): Fixed bug and simplified code.
+        (createTransformedShape): Return null on null parameter.
+
+2004-11-24  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/util/Collections.java:
         Resynced with GNU Classpath.
 




More information about the kaffe mailing list