outline optimization

This commit is contained in:
bancika
2011-01-16 08:38:10 +00:00
parent 7fd817191b
commit 1781c45317
@@ -62,7 +62,7 @@ class G2DWrapper extends Graphics2D {
private Font originalFont; private Font originalFont;
private AffineTransform currentTx; private AffineTransform currentTx;
private Area currentArea; private Area currentArea;
private Shape lastFilledShape; private Shape lastShape;
/** /**
* Creates a wrapper around specified {@link Graphics2D} object. * Creates a wrapper around specified {@link Graphics2D} object.
@@ -88,7 +88,7 @@ class G2DWrapper extends Graphics2D {
originalComposite = canvasGraphics.getComposite(); originalComposite = canvasGraphics.getComposite();
originalFont = canvasGraphics.getFont(); originalFont = canvasGraphics.getFont();
currentTx = new AffineTransform(); currentTx = new AffineTransform();
lastFilledShape = null; lastShape = null;
} }
/** /**
@@ -119,7 +119,7 @@ class G2DWrapper extends Graphics2D {
Area area = new Area(s); Area area = new Area(s);
area.transform(currentTx); area.transform(currentTx);
currentArea.add(area); currentArea.add(area);
lastFilledShape = s; lastShape = s;
} }
/** /**
@@ -129,9 +129,10 @@ class G2DWrapper extends Graphics2D {
*/ */
private void appendShapeOutline(Shape s) { private void appendShapeOutline(Shape s) {
// Do not add shape outline if the same shape has been filled recently. // Do not add shape outline if the same shape has been filled recently.
if (!drawingComponent || s.equals(lastFilledShape)) { if (!drawingComponent || s.equals(lastShape)) {
return; return;
} }
lastShape = s;
PathIterator pathIterator = s.getPathIterator(null); PathIterator pathIterator = s.getPathIterator(null);
double thickness; double thickness;
if (getStroke() instanceof BasicStroke) { if (getStroke() instanceof BasicStroke) {