}
if (start >= count)
break; // No more segments with valid tangents
ShapeRecord startSegment = records.get(start);
if (startSegment instanceof StyleChangeRecord)
{
// remember the last move segment
lastOpenSegment = start + 1;
lastMoveX = ((StyleChangeRecord)startSegment).moveDeltaX;
lastMoveY = ((StyleChangeRecord)startSegment).moveDeltaY;
// move onto next segment:
start++;
continue;
}
// Does the current segment close to a previous segment and form a
// joint with it?
// Note, even if the segment was originally a close segment,
// it may not form a joint with the segment it closes to, unless
// it's followed by a MoveSegment or it's the last segment in the
// sequence.
int startSegmentX = cooridinates[start][0];
int startSegmentY = cooridinates[start][1];
if ((start == count - 1 || records.get(start + 1) instanceof StyleChangeRecord) &&
startSegmentX == lastMoveX &&
startSegmentY == lastMoveY)
{
end = lastOpenSegment;
}
else
{
end = start + 1;
}
// Find a segment with a valid tangent or stop at a MoveSegment
while (end < count && !(records.get(end) instanceof StyleChangeRecord))
{
if (tangentIsValid(records.get(end), startSegmentX, startSegmentY))
break;
end++;
}
if (end >= count)
break; // No more segments with valid tangents
ShapeRecord endSegment = records.get(end);
if (!(endSegment instanceof StyleChangeRecord))
{
newRect = addMiterLimitStrokeToBounds(
startSegment,
endSegment,