< prev index next >
src/java.desktop/share/classes/java/awt/geom/Path2D.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 185,195 ****
* coordinates stored in single precision floating point.
*
* @since 1.6
*/
public static class Float extends Path2D implements Serializable {
! transient float floatCoords[];
/**
* Constructs a new empty single precision {@code Path2D} object
* with a default winding rule of {@link #WIND_NON_ZERO}.
*
--- 185,195 ----
* coordinates stored in single precision floating point.
*
* @since 1.6
*/
public static class Float extends Path2D implements Serializable {
! transient float[] floatCoords;
/**
* Constructs a new empty single precision {@code Path2D} object
* with a default winding rule of {@link #WIND_NON_ZERO}.
*
*** 288,298 ****
}
@Override
float[] cloneCoordsFloat(AffineTransform at) {
// trim arrays:
! float ret[];
if (at == null) {
ret = Arrays.copyOf(floatCoords, numCoords);
} else {
ret = new float[numCoords];
at.transform(floatCoords, 0, ret, 0, numCoords / 2);
--- 288,298 ----
}
@Override
float[] cloneCoordsFloat(AffineTransform at) {
// trim arrays:
! float[] ret;
if (at == null) {
ret = Arrays.copyOf(floatCoords, numCoords);
} else {
ret = new float[numCoords];
at.transform(floatCoords, 0, ret, 0, numCoords / 2);
*** 301,311 ****
}
@Override
double[] cloneCoordsDouble(AffineTransform at) {
// trim arrays:
! double ret[] = new double[numCoords];
if (at == null) {
for (int i = 0; i < numCoords; i++) {
ret[i] = floatCoords[i];
}
} else {
--- 301,311 ----
}
@Override
double[] cloneCoordsDouble(AffineTransform at) {
// trim arrays:
! double[] ret = new double[numCoords];
if (at == null) {
for (int i = 0; i < numCoords; i++) {
ret[i] = floatCoords[i];
}
} else {
*** 553,563 ****
int pointCrossings(double px, double py) {
if (numTypes == 0) {
return 0;
}
double movx, movy, curx, cury, endx, endy;
! float coords[] = floatCoords;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
for (int i = 1; i < numTypes; i++) {
--- 553,563 ----
int pointCrossings(double px, double py) {
if (numTypes == 0) {
return 0;
}
double movx, movy, curx, cury, endx, endy;
! float[] coords = floatCoords;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
for (int i = 1; i < numTypes; i++) {
*** 632,642 ****
double rxmax, double rymax)
{
if (numTypes == 0) {
return 0;
}
! float coords[] = floatCoords;
double curx, cury, movx, movy, endx, endy;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
--- 632,642 ----
double rxmax, double rymax)
{
if (numTypes == 0) {
return 0;
}
! float[] coords = floatCoords;
double curx, cury, movx, movy, endx, endy;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
*** 734,744 ****
/**
* {@inheritDoc}
* @since 1.6
*/
public final void append(PathIterator pi, boolean connect) {
! float coords[] = new float[6];
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case SEG_MOVETO:
if (!connect || numTypes < 1 || numCoords < 1) {
moveTo(coords[0], coords[1]);
--- 734,744 ----
/**
* {@inheritDoc}
* @since 1.6
*/
public final void append(PathIterator pi, boolean connect) {
! float[] coords = new float[6];
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case SEG_MOVETO:
if (!connect || numTypes < 1 || numCoords < 1) {
moveTo(coords[0], coords[1]);
*** 1002,1012 ****
{
super.readObject(s, false);
}
static class CopyIterator extends Path2D.Iterator {
! float floatCoords[];
CopyIterator(Path2D.Float p2df) {
super(p2df);
this.floatCoords = p2df.floatCoords;
}
--- 1002,1012 ----
{
super.readObject(s, false);
}
static class CopyIterator extends Path2D.Iterator {
! float[] floatCoords;
CopyIterator(Path2D.Float p2df) {
super(p2df);
this.floatCoords = p2df.floatCoords;
}
*** 1032,1042 ****
return type;
}
}
static class TxIterator extends Path2D.Iterator {
! float floatCoords[];
AffineTransform affine;
TxIterator(Path2D.Float p2df, AffineTransform at) {
super(p2df);
this.floatCoords = p2df.floatCoords;
--- 1032,1042 ----
return type;
}
}
static class TxIterator extends Path2D.Iterator {
! float[] floatCoords;
AffineTransform affine;
TxIterator(Path2D.Float p2df, AffineTransform at) {
super(p2df);
this.floatCoords = p2df.floatCoords;
*** 1071,1081 ****
* coordinates stored in double precision floating point.
*
* @since 1.6
*/
public static class Double extends Path2D implements Serializable {
! transient double doubleCoords[];
/**
* Constructs a new empty double precision {@code Path2D} object
* with a default winding rule of {@link #WIND_NON_ZERO}.
*
--- 1071,1081 ----
* coordinates stored in double precision floating point.
*
* @since 1.6
*/
public static class Double extends Path2D implements Serializable {
! transient double[] doubleCoords;
/**
* Constructs a new empty double precision {@code Path2D} object
* with a default winding rule of {@link #WIND_NON_ZERO}.
*
*** 1174,1184 ****
}
@Override
float[] cloneCoordsFloat(AffineTransform at) {
// trim arrays:
! float ret[] = new float[numCoords];
if (at == null) {
for (int i = 0; i < numCoords; i++) {
ret[i] = (float) doubleCoords[i];
}
} else {
--- 1174,1184 ----
}
@Override
float[] cloneCoordsFloat(AffineTransform at) {
// trim arrays:
! float[] ret = new float[numCoords];
if (at == null) {
for (int i = 0; i < numCoords; i++) {
ret[i] = (float) doubleCoords[i];
}
} else {
*** 1188,1198 ****
}
@Override
double[] cloneCoordsDouble(AffineTransform at) {
// trim arrays:
! double ret[];
if (at == null) {
ret = Arrays.copyOf(doubleCoords, numCoords);
} else {
ret = new double[numCoords];
at.transform(doubleCoords, 0, ret, 0, numCoords / 2);
--- 1188,1198 ----
}
@Override
double[] cloneCoordsDouble(AffineTransform at) {
// trim arrays:
! double[] ret;
if (at == null) {
ret = Arrays.copyOf(doubleCoords, numCoords);
} else {
ret = new double[numCoords];
at.transform(doubleCoords, 0, ret, 0, numCoords / 2);
*** 1328,1338 ****
int pointCrossings(double px, double py) {
if (numTypes == 0) {
return 0;
}
double movx, movy, curx, cury, endx, endy;
! double coords[] = doubleCoords;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
for (int i = 1; i < numTypes; i++) {
--- 1328,1338 ----
int pointCrossings(double px, double py) {
if (numTypes == 0) {
return 0;
}
double movx, movy, curx, cury, endx, endy;
! double[] coords = doubleCoords;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
for (int i = 1; i < numTypes; i++) {
*** 1407,1417 ****
double rxmax, double rymax)
{
if (numTypes == 0) {
return 0;
}
! double coords[] = doubleCoords;
double curx, cury, movx, movy, endx, endy;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
--- 1407,1417 ----
double rxmax, double rymax)
{
if (numTypes == 0) {
return 0;
}
! double[] coords = doubleCoords;
double curx, cury, movx, movy, endx, endy;
curx = movx = coords[0];
cury = movy = coords[1];
int crossings = 0;
int ci = 2;
*** 1510,1520 ****
/**
* {@inheritDoc}
* @since 1.6
*/
public final void append(PathIterator pi, boolean connect) {
! double coords[] = new double[6];
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case SEG_MOVETO:
if (!connect || numTypes < 1 || numCoords < 1) {
moveTo(coords[0], coords[1]);
--- 1510,1520 ----
/**
* {@inheritDoc}
* @since 1.6
*/
public final void append(PathIterator pi, boolean connect) {
! double[] coords = new double[6];
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case SEG_MOVETO:
if (!connect || numTypes < 1 || numCoords < 1) {
moveTo(coords[0], coords[1]);
*** 1777,1787 ****
{
super.readObject(s, true);
}
static class CopyIterator extends Path2D.Iterator {
! double doubleCoords[];
CopyIterator(Path2D.Double p2dd) {
super(p2dd);
this.doubleCoords = p2dd.doubleCoords;
}
--- 1777,1787 ----
{
super.readObject(s, true);
}
static class CopyIterator extends Path2D.Iterator {
! double[] doubleCoords;
CopyIterator(Path2D.Double p2dd) {
super(p2dd);
this.doubleCoords = p2dd.doubleCoords;
}
*** 1807,1817 ****
return type;
}
}
static class TxIterator extends Path2D.Iterator {
! double doubleCoords[];
AffineTransform affine;
TxIterator(Path2D.Double p2dd, AffineTransform at) {
super(p2dd);
this.doubleCoords = p2dd.doubleCoords;
--- 1807,1817 ----
return type;
}
}
static class TxIterator extends Path2D.Iterator {
! double[] doubleCoords;
AffineTransform affine;
TxIterator(Path2D.Double p2dd, AffineTransform at) {
super(p2dd);
this.doubleCoords = p2dd.doubleCoords;
*** 2535,2546 ****
final void writeObject(java.io.ObjectOutputStream s, boolean isdbl)
throws java.io.IOException
{
s.defaultWriteObject();
! float fCoords[];
! double dCoords[];
if (isdbl) {
dCoords = ((Path2D.Double) this).doubleCoords;
fCoords = null;
} else {
--- 2535,2546 ----
final void writeObject(java.io.ObjectOutputStream s, boolean isdbl)
throws java.io.IOException
{
s.defaultWriteObject();
! float[] fCoords;
! double[] dCoords;
if (isdbl) {
dCoords = ((Path2D.Double) this).doubleCoords;
fCoords = null;
} else {
*** 2724,2734 ****
abstract static class Iterator implements PathIterator {
int typeIdx;
int pointIdx;
Path2D path;
! static final int curvecoords[] = {2, 2, 4, 6, 0};
Iterator(Path2D path) {
this.path = path;
}
--- 2724,2734 ----
abstract static class Iterator implements PathIterator {
int typeIdx;
int pointIdx;
Path2D path;
! static final int[] curvecoords = {2, 2, 4, 6, 0};
Iterator(Path2D path) {
this.path = path;
}
< prev index next >