aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/geom/CubicCurve2D.java
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@redhat.com>2003-07-18 19:20:33 +0000
committerGraydon Hoare <graydon@gcc.gnu.org>2003-07-18 19:20:33 +0000
commit9e508cc4703391622b221a3a7aed00938be9f2ba (patch)
treea1aabeff099d1c04105b8a5b341a1349788466fa /libjava/java/awt/geom/CubicCurve2D.java
parent0595d388a4b11459dc47c0bebf7b8895f8e9d331 (diff)
downloadgcc-9e508cc4703391622b221a3a7aed00938be9f2ba.zip
gcc-9e508cc4703391622b221a3a7aed00938be9f2ba.tar.gz
gcc-9e508cc4703391622b221a3a7aed00938be9f2ba.tar.bz2
[ ChangeLog ]
2003-07-18 Graydon Hoare <graydon@redhat.com> * java/awt/geom/CubicCurve2D.java, java/awt/geom/Line2D.java, java/awt/geom/QuadCurve2D.java, java/awt/geom/Rectangle2D.java: Fix path some calculations, make path iterators follow a consistent style. From-SVN: r69567
Diffstat (limited to 'libjava/java/awt/geom/CubicCurve2D.java')
-rw-r--r--libjava/java/awt/geom/CubicCurve2D.java54
1 files changed, 29 insertions, 25 deletions
diff --git a/libjava/java/awt/geom/CubicCurve2D.java b/libjava/java/awt/geom/CubicCurve2D.java
index 2d303c7..2bc0b35 100644
--- a/libjava/java/awt/geom/CubicCurve2D.java
+++ b/libjava/java/awt/geom/CubicCurve2D.java
@@ -204,7 +204,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
return new PathIterator()
{
/** Current coordinate. */
- private int current;
+ private int current = 0;
public int getWindingRule()
{
@@ -213,7 +213,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
public boolean isDone()
{
- return current < 2;
+ return current >= 2;
}
public void next()
@@ -223,52 +223,56 @@ public abstract class CubicCurve2D implements Shape, Cloneable
public int currentSegment(float[] coords)
{
- if (current == 0)
+ int result;
+ switch (current)
{
+ case 0:
coords[0] = (float) getX1();
coords[1] = (float) getY1();
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return SEG_MOVETO;
- }
- if (current == 1)
- {
+ result = SEG_MOVETO;
+ break;
+ case 1:
coords[0] = (float) getCtrlX1();
coords[1] = (float) getCtrlY1();
coords[2] = (float) getCtrlX2();
coords[3] = (float) getCtrlY2();
coords[4] = (float) getX2();
coords[5] = (float) getY2();
- if (at != null)
- at.transform(coords, 0, coords, 0, 3);
- return SEG_CUBICTO;
+ result = SEG_CUBICTO;
+ break;
+ default:
+ throw new NoSuchElementException("cubic iterator out of bounds");
}
- throw new NoSuchElementException("cubic iterator out of bounds");
+ if (at != null)
+ at.transform(coords, 0, coords, 0, 3);
+ return result;
}
public int currentSegment(double[] coords)
{
- if (current == 0)
+ int result;
+ switch (current)
{
+ case 0:
coords[0] = getX1();
coords[1] = getY1();
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return SEG_MOVETO;
- }
- if (current == 1)
- {
+ result = SEG_MOVETO;
+ break;
+ case 1:
coords[0] = getCtrlX1();
coords[1] = getCtrlY1();
coords[2] = getCtrlX2();
coords[3] = getCtrlY2();
coords[4] = getX2();
coords[5] = getY2();
- if (at != null)
- at.transform(coords, 0, coords, 0, 3);
- return SEG_CUBICTO;
- }
- throw new NoSuchElementException("cubic iterator out of bounds");
+ result = SEG_CUBICTO;
+ break;
+ default:
+ throw new NoSuchElementException("cubic iterator out of bounds");
+ }
+ if (at != null)
+ at.transform(coords, 0, coords, 0, 3);
+ return result;
}
};
}