painting optimization

This commit is contained in:
bancika
2011-01-16 08:45:22 +00:00
parent 1781c45317
commit e1377a8b09
@@ -128,18 +128,16 @@ class CanvasPanel extends JComponent implements Autoscroll {
if (volatileImage.contentsLost()) { if (volatileImage.contentsLost()) {
createBufferImage(); createBufferImage();
} }
int validation = volatileImage.validate(screenGraphicsConfiguration); // int validation = volatileImage.validate(screenGraphicsConfiguration);
if (validation == VolatileImage.IMAGE_INCOMPATIBLE) { // if (validation == VolatileImage.IMAGE_INCOMPATIBLE) {
createBufferImage(); // createBufferImage();
} // }
g.drawImage(bufferImage, 0, 0, this); g.drawImage(bufferImage, 0, 0, this);
} catch (NullPointerException e) { } catch (NullPointerException e) {
createBufferImage(); createBufferImage();
} }
} while (volatileImage == null || volatileImage.contentsLost()); } while (volatileImage == null || volatileImage.contentsLost());
} else { } else {
Graphics2D g2d = (Graphics2D) bufferImage.getGraphics();
plugInPort.draw(g2d, DRAW_OPTIONS, null);
g.drawImage(bufferImage, 0, 0, this); g.drawImage(bufferImage, 0, 0, this);
bufferImage.flush(); bufferImage.flush();
} }