Skip to content

Commit

Permalink
#72887 Fixed by checking location range in device renderer to avoid long
Browse files Browse the repository at this point in the history
time to render
  • Loading branch information
Yulin Wang committed Apr 30, 2014
1 parent d93847a commit 17e2501
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -490,6 +490,12 @@ public void drawLine( LineRenderEvent lre ) throws ChartException
// DRAW THE LINE
final Location loStart = lre.getStart( );
final Location loEnd = lre.getEnd( );
// #72887 Location may be beyond integer range and need long time to
// render
if ( !checkValidLocation( loStart ) || !checkValidLocation( loEnd ) )
{
return;
}
Stroke sPrevious = null, sCurrent = getCachedStroke( lia );
if ( sCurrent != null ) // SOME STROKE DEFINED?
{
Expand All @@ -508,6 +514,16 @@ public void drawLine( LineRenderEvent lre ) throws ChartException
_g2d.setStroke( sPrevious );
}
}

protected boolean checkValidLocation( Location lo )
{
// If the location is out of integer range, it needs endless time to
// render
return lo.getX( ) < Integer.MAX_VALUE
&& lo.getX( ) > Integer.MIN_VALUE
&& lo.getY( ) < Integer.MAX_VALUE
&& lo.getY( ) > Integer.MIN_VALUE;
}

@Override
public void drawRectangle( RectangleRenderEvent rre ) throws ChartException
Expand Down

0 comments on commit 17e2501

Please sign in to comment.