Commit 9e508cc4 by Graydon Hoare Committed by Graydon Hoare

[ 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
parent 0595d388
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.
2003-07-18 Mark Wielaard <mark@klomp.org> 2003-07-18 Mark Wielaard <mark@klomp.org>
* java/util/logging/Handler.java (isLoggable): Check record level * java/util/logging/Handler.java (isLoggable): Check record level
......
...@@ -204,7 +204,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable ...@@ -204,7 +204,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
return new PathIterator() return new PathIterator()
{ {
/** Current coordinate. */ /** Current coordinate. */
private int current; private int current = 0;
public int getWindingRule() public int getWindingRule()
{ {
...@@ -213,7 +213,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable ...@@ -213,7 +213,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
public boolean isDone() public boolean isDone()
{ {
return current < 2; return current >= 2;
} }
public void next() public void next()
...@@ -223,52 +223,56 @@ public abstract class CubicCurve2D implements Shape, Cloneable ...@@ -223,52 +223,56 @@ public abstract class CubicCurve2D implements Shape, Cloneable
public int currentSegment(float[] coords) public int currentSegment(float[] coords)
{ {
if (current == 0) int result;
switch (current)
{ {
case 0:
coords[0] = (float) getX1(); coords[0] = (float) getX1();
coords[1] = (float) getY1(); coords[1] = (float) getY1();
if (at != null) result = SEG_MOVETO;
at.transform(coords, 0, coords, 0, 1); break;
return SEG_MOVETO; case 1:
}
if (current == 1)
{
coords[0] = (float) getCtrlX1(); coords[0] = (float) getCtrlX1();
coords[1] = (float) getCtrlY1(); coords[1] = (float) getCtrlY1();
coords[2] = (float) getCtrlX2(); coords[2] = (float) getCtrlX2();
coords[3] = (float) getCtrlY2(); coords[3] = (float) getCtrlY2();
coords[4] = (float) getX2(); coords[4] = (float) getX2();
coords[5] = (float) getY2(); coords[5] = (float) getY2();
if (at != null) result = SEG_CUBICTO;
at.transform(coords, 0, coords, 0, 3); break;
return SEG_CUBICTO; 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) public int currentSegment(double[] coords)
{ {
if (current == 0) int result;
switch (current)
{ {
case 0:
coords[0] = getX1(); coords[0] = getX1();
coords[1] = getY1(); coords[1] = getY1();
if (at != null) result = SEG_MOVETO;
at.transform(coords, 0, coords, 0, 1); break;
return SEG_MOVETO; case 1:
}
if (current == 1)
{
coords[0] = getCtrlX1(); coords[0] = getCtrlX1();
coords[1] = getCtrlY1(); coords[1] = getCtrlY1();
coords[2] = getCtrlX2(); coords[2] = getCtrlX2();
coords[3] = getCtrlY2(); coords[3] = getCtrlY2();
coords[4] = getX2(); coords[4] = getX2();
coords[5] = getY2(); coords[5] = getY2();
if (at != null) result = SEG_CUBICTO;
at.transform(coords, 0, coords, 0, 3); break;
return SEG_CUBICTO; 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;
} }
}; };
} }
......
...@@ -668,7 +668,7 @@ public abstract class Line2D implements Shape, Cloneable ...@@ -668,7 +668,7 @@ public abstract class Line2D implements Shape, Cloneable
return new PathIterator() return new PathIterator()
{ {
/** Current coordinate. */ /** Current coordinate. */
private int current; private int current = 0;
public int getWindingRule() public int getWindingRule()
{ {
...@@ -677,7 +677,7 @@ public abstract class Line2D implements Shape, Cloneable ...@@ -677,7 +677,7 @@ public abstract class Line2D implements Shape, Cloneable
public boolean isDone() public boolean isDone()
{ {
return current < 2; return current >= 2;
} }
public void next() public void next()
......
...@@ -215,7 +215,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable ...@@ -215,7 +215,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable
return new PathIterator() return new PathIterator()
{ {
/** Current coordinate. */ /** Current coordinate. */
private int current; private int current = 0;
public int getWindingRule() public int getWindingRule()
{ {
...@@ -224,7 +224,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable ...@@ -224,7 +224,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable
public boolean isDone() public boolean isDone()
{ {
return current < 2; return current >= 2;
} }
public void next() public void next()
...@@ -234,48 +234,52 @@ public abstract class QuadCurve2D implements Shape, Cloneable ...@@ -234,48 +234,52 @@ public abstract class QuadCurve2D implements Shape, Cloneable
public int currentSegment(float[] coords) public int currentSegment(float[] coords)
{ {
if (current == 0) int result;
switch (current)
{ {
case 0:
coords[0] = (float) getX1(); coords[0] = (float) getX1();
coords[1] = (float) getY1(); coords[1] = (float) getY1();
if (at != null) result = SEG_MOVETO;
at.transform(coords, 0, coords, 0, 1); break;
return SEG_MOVETO; case 1:
}
if (current == 1)
{
coords[0] = (float) getCtrlX(); coords[0] = (float) getCtrlX();
coords[1] = (float) getCtrlY(); coords[1] = (float) getCtrlY();
coords[2] = (float) getX2(); coords[2] = (float) getX2();
coords[3] = (float) getY2(); coords[3] = (float) getY2();
if (at != null) result = SEG_QUADTO;
at.transform(coords, 0, coords, 0, 2); break;
return SEG_QUADTO; default:
throw new NoSuchElementException("quad iterator out of bounds");
} }
throw new NoSuchElementException("quad iterator out of bounds"); if (at != null)
at.transform(coords, 0, coords, 0, 2);
return result;
} }
public int currentSegment(double[] coords) public int currentSegment(double[] coords)
{ {
if (current == 0) int result;
switch (current)
{ {
case 0:
coords[0] = getX1(); coords[0] = getX1();
coords[1] = getY1(); coords[1] = getY1();
if (at != null) result = SEG_MOVETO;
at.transform(coords, 0, coords, 0, 1); break;
return SEG_MOVETO; case 1:
}
if (current == 1)
{
coords[0] = getCtrlX(); coords[0] = getCtrlX();
coords[1] = getCtrlY(); coords[1] = getCtrlY();
coords[2] = getX2(); coords[2] = getX2();
coords[3] = getY2(); coords[3] = getY2();
if (at != null) result = SEG_QUADTO;
at.transform(coords, 0, coords, 0, 2); break;
return SEG_QUADTO; default:
throw new NoSuchElementException("quad iterator out of bounds");
} }
throw new NoSuchElementException("quad iterator out of bounds"); if (at != null)
at.transform(coords, 0, coords, 0, 2);
return result;
} }
}; };
} }
......
...@@ -395,7 +395,7 @@ public abstract class Rectangle2D extends RectangularShape ...@@ -395,7 +395,7 @@ public abstract class Rectangle2D extends RectangularShape
return new PathIterator() return new PathIterator()
{ {
/** Current coordinate. */ /** Current coordinate. */
private int current = (maxx >= minx && maxy >= miny) ? 6 : 0; private int current = (maxx <= minx && maxy <= miny) ? 6 : 0;
public int getWindingRule() public int getWindingRule()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment