mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
outline optimization
This commit is contained in:
+5
-4
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user