From: Marko Luukkainen Date: Wed, 15 Feb 2017 14:14:32 +0000 (+0200) Subject: Allow bypassing VolatileImage rendering to gain performance X-Git-Tag: v1.28.0~80 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F333%2F1;p=simantics%2Fplatform.git Allow bypassing VolatileImage rendering to gain performance refs #7034 Change-Id: I3a53175ed86ba9b0705498f8c0652fec69cc1cd1 --- diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/chassis/AWTChassis.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/chassis/AWTChassis.java index 17304ef3e..2679ef620 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/chassis/AWTChassis.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/chassis/AWTChassis.java @@ -81,6 +81,8 @@ public class AWTChassis extends JComponent implements ICanvasChassis { private transient boolean closed = false; protected ICanvasContext canvasContext; + private boolean useVolatileImage = true; + // Marks the content dirty protected IContentListener contentListener = new IContentListener() { @Override @@ -277,6 +279,14 @@ public class AWTChassis extends JComponent implements ICanvasChassis { public IHintContext getHintContext() { return hintCtx; } + + public void setUseVolatileImage(boolean useVolatileImage) { + this.useVolatileImage = useVolatileImage; + } + + public boolean isUseVolatileImage() { + return useVolatileImage; + } private void paintScenegraph(Graphics2D g2d, Rectangle controlBounds) { Color bg = getBackground(); @@ -355,7 +365,9 @@ public class AWTChassis extends JComponent implements ICanvasChassis { startmem = Runtime.getRuntime().freeMemory(); start = System.nanoTime(); } - VolatileImage buffer = paintToVolatileImage(g2d, b); + VolatileImage buffer = null; + if (useVolatileImage) + buffer = paintToVolatileImage(g2d, b); if (closed) return; if (DebugPolicy.PERF_CHASSIS_RENDER_FRAME) {