closeCoord[1] = -0.5f;
transXf -= 0.5;
transYf -= 0.5;
}
PathIterator pi = p2df.getPathIterator(null);
while (!pi.isDone()) {
switch (pi.currentSegment(coords)) {
case PathIterator.SEG_MOVETO:
/* Performing closing of the unclosed segments */
if (subpathStarted && !skip) {
if (hnd.clipMode == PH_MODE_FILL_CLIP) {
if (tCoords[0] != closeCoord[0] ||
tCoords[1] != closeCoord[1])
{
ProcessLine(hnd, tCoords[0], tCoords[1],
closeCoord[0], closeCoord[1],
pixelInfo);
}
}
hnd.processEndSubPath();
}
tCoords[0] = coords[0] + transXf;
tCoords[1] = coords[1] + transYf;
/* Checking SEG_MOVETO coordinates if they are out of the
* [LOWER_BND, UPPER_BND] range. This check also handles
* NaN and Infinity values. Skipping next path segment in
* case of invalid data.
*/
if (tCoords[0] < UPPER_BND &&
tCoords[0] > LOWER_BND &&
tCoords[1] < UPPER_BND &&
tCoords[1] > LOWER_BND)
{
subpathStarted = true;
skip = false;
closeCoord[0] = tCoords[0];
closeCoord[1] = tCoords[1];
} else {
skip = true;
}
pixelInfo[0] = 0;
break;
case PathIterator.SEG_LINETO:
lastX = tCoords[2] = coords[0] + transXf;
lastY = tCoords[3] = coords[1] + transYf;
/* Checking SEG_LINETO coordinates if they are out of the
* [LOWER_BND, UPPER_BND] range. This check also handles
* NaN and Infinity values. Ignoring current path segment
* in case of invalid data. If segment is skipped its
* endpoint (if valid) is used to begin new subpath.
*/
if (lastX < UPPER_BND &&
lastX > LOWER_BND &&
lastY < UPPER_BND &&
lastY > LOWER_BND)
{
if (skip) {
tCoords[0] = closeCoord[0] = lastX;
tCoords[1] = closeCoord[1] = lastY;
subpathStarted = true;
skip = false;
} else {
ProcessLine(hnd, tCoords[0], tCoords[1],
tCoords[2], tCoords[3], pixelInfo);
tCoords[0] = lastX;
tCoords[1] = lastY;
}
}
break;
case PathIterator.SEG_QUADTO:
tCoords[2] = coords[0] + transXf;
tCoords[3] = coords[1] + transYf;
lastX = tCoords[4] = coords[2] + transXf;
lastY = tCoords[5] = coords[3] + transYf;
/* Checking SEG_QUADTO coordinates if they are out of the
* [LOWER_BND, UPPER_BND] range. This check also handles
* NaN and Infinity values. Ignoring current path segment
* in case of invalid endpoints's data. Equivalent to
* the SEG_LINETO if endpoint coordinates are valid but
* there are invalid data among other coordinates
*/
if (lastX < UPPER_BND &&
lastX > LOWER_BND &&
lastY < UPPER_BND &&
lastY > LOWER_BND)
{
if (skip) {
tCoords[0] = closeCoord[0] = lastX;
tCoords[1] = closeCoord[1] = lastY;
subpathStarted = true;
skip = false;
} else {
if (tCoords[2] < UPPER_BND &&
tCoords[2] > LOWER_BND &&
tCoords[3] < UPPER_BND &&
tCoords[3] > LOWER_BND)
{
ProcessQuad(hnd, tCoords, pixelInfo);
} else {
ProcessLine(hnd, tCoords[0], tCoords[1],
tCoords[4], tCoords[5],
pixelInfo);
}
tCoords[0] = lastX;
tCoords[1] = lastY;
}
}
break;
case PathIterator.SEG_CUBICTO:
tCoords[2] = coords[0] + transXf;
tCoords[3] = coords[1] + transYf;
tCoords[4] = coords[2] + transXf;
tCoords[5] = coords[3] + transYf;
lastX = tCoords[6] = coords[4] + transXf;
lastY = tCoords[7] = coords[5] + transYf;
/* Checking SEG_CUBICTO coordinates if they are out of the
* [LOWER_BND, UPPER_BND] range. This check also handles
* NaN and Infinity values. Ignoring current path segment
* in case of invalid endpoints's data. Equivalent to
* the SEG_LINETO if endpoint coordinates are valid but
* there are invalid data among other coordinates
*/
if (lastX < UPPER_BND &&
lastX > LOWER_BND &&
lastY < UPPER_BND &&
lastY > LOWER_BND)
{
if (skip) {
tCoords[0] = closeCoord[0] = tCoords[6];
tCoords[1] = closeCoord[1] = tCoords[7];
subpathStarted = true;
skip = false;
} else {
if (tCoords[2] < UPPER_BND &&
tCoords[2] > LOWER_BND &&
tCoords[3] < UPPER_BND &&
tCoords[3] > LOWER_BND &&
tCoords[4] < UPPER_BND &&
tCoords[4] > LOWER_BND &&
tCoords[5] < UPPER_BND &&
tCoords[5] > LOWER_BND)
{
ProcessCubic(hnd, tCoords, pixelInfo);
} else {
ProcessLine(hnd, tCoords[0], tCoords[1],
tCoords[6], tCoords[7],
pixelInfo);
}
tCoords[0] = lastX;
tCoords[1] = lastY;
}
}
break;
case PathIterator.SEG_CLOSE:
if (subpathStarted && !skip) {
skip = false;
if (tCoords[0] != closeCoord[0] ||
tCoords[1] != closeCoord[1])
{
ProcessLine(hnd, tCoords[0], tCoords[1],
closeCoord[0], closeCoord[1],
pixelInfo);
/* Storing last path's point for using in following
* segments without initial moveTo
*/
tCoords[0] = closeCoord[0];
tCoords[1] = closeCoord[1];
}
hnd.processEndSubPath();
}
break;
}
pi.next();
}
/* Performing closing of the unclosed segments */
if (subpathStarted & !skip) {
if (hnd.clipMode == PH_MODE_FILL_CLIP) {