Shape caching entfernt

In Tests konnten keine Geschwindigkeitsvorteile festgestellt werden.
This commit is contained in:
ngb
2022-07-25 19:05:28 +02:00
parent bd2364a8df
commit 97ff03990a
2 changed files with 4 additions and 21 deletions

View File

@@ -15,6 +15,8 @@ public class Rectangle extends Shape {
this.width = width; this.width = width;
this.height = height; this.height = height;
this.anchor = Options.Direction.NORTHWEST; this.anchor = Options.Direction.NORTHWEST;
//this.cacheEnabled = getClass().equals(Rectangle.class);
} }
public Rectangle( Rectangle pRechteck ) { public Rectangle( Rectangle pRechteck ) {
@@ -64,12 +66,10 @@ public class Rectangle extends Shape {
public void setWidth( double width ) { public void setWidth( double width ) {
this.width = width; this.width = width;
invalidate();
} }
public void setHeight( double height ) { public void setHeight( double height ) {
this.height = height; this.height = height;
invalidate();
} }
@Override @Override
@@ -92,7 +92,6 @@ public class Rectangle extends Shape {
super.scale(factor); super.scale(factor);
width *= factor; width *= factor;
height *= factor; height *= factor;
invalidate();
} }
@Override @Override

View File

@@ -66,11 +66,6 @@ public abstract class Shape extends FilledShape {
*/ */
protected Options.Direction anchor = Options.Direction.CENTER; protected Options.Direction anchor = Options.Direction.CENTER;
/**
* Zwischenspeicher für die AWT-Shape zu dieser Form.
*/
protected java.awt.Shape awtShape = null;
/** /**
* Setzt die x- und y-Koordinate der Form auf 0. * Setzt die x- und y-Koordinate der Form auf 0.
*/ */
@@ -406,13 +401,6 @@ public abstract class Shape extends FilledShape {
*/ */
public abstract java.awt.Shape getShape(); public abstract java.awt.Shape getShape();
/**
* Interne Methode, um den Zwischenspeicher der Java-AWT Shape zu löschen.
*/
protected void invalidate() {
awtShape = null;
}
/** /**
* Gibt die Begrenzungen der Form zurück. * Gibt die Begrenzungen der Form zurück.
* <p> * <p>
@@ -566,12 +554,8 @@ public abstract class Shape extends FilledShape {
return; return;
} }
if( awtShape == null ) { java.awt.Shape shape = getShape();
awtShape = getShape(); if( shape != null ) {
}
if( awtShape != null ) {
java.awt.Shape shape = awtShape;
if( transform != null ) { if( transform != null ) {
shape = transform.createTransformedShape(shape); shape = transform.createTransformedShape(shape);
} }