fix for flicker in JAVA2D mode (issue #558)

This commit is contained in:
benfry
2011-03-09 17:43:46 +00:00
parent adbcafa53d
commit fbfca79ca0
2 changed files with 16 additions and 3 deletions
+14 -3
View File
@@ -1445,10 +1445,18 @@ public class PApplet extends Applet
// make sure the screen is visible and usable // make sure the screen is visible and usable
// (also prevents over-drawing when using PGraphicsOpenGL) // (also prevents over-drawing when using PGraphicsOpenGL)
if ((g != null) && (g.image != null)) { if (g != null) {
// println("inside paint(), screen.drawImage()"); // added synchronization for 0194 because of flicker issues with JAVA2D
screen.drawImage(g.image, 0, 0, null); //
synchronized (g) {
if (g.image != null) {
screen.drawImage(g.image, 0, 0, null);
}
}
} }
// if ((g != null) && (g.image != null)) {
// screen.drawImage(g.image, 0, 0, null);
// }
} }
@@ -1565,6 +1573,7 @@ public class PApplet extends Applet
//System.out.println("handleDraw() " + frameCount); //System.out.println("handleDraw() " + frameCount);
synchronized (g) {
g.beginDraw(); g.beginDraw();
if (recorder != null) { if (recorder != null) {
recorder.beginDraw(); recorder.beginDraw();
@@ -1620,12 +1629,14 @@ public class PApplet extends Applet
} }
g.endDraw(); g.endDraw();
if (recorder != null) { if (recorder != null) {
recorder.endDraw(); recorder.endDraw();
} }
frameRateLastNanos = now; frameRateLastNanos = now;
frameCount++; frameCount++;
}
repaint(); repaint();
getToolkit().sync(); // force repaint now (proper method) getToolkit().sync(); // force repaint now (proper method)
+2
View File
@@ -1,4 +1,6 @@
0194 core 0194 core
X flicker between background and rest with JAVA2D
X http://code.google.com/p/processing/issues/detail?id=558
_ bug: textAlign(RIGHT) is shutting off native fonts _ bug: textAlign(RIGHT) is shutting off native fonts