trying to track down flickering issue with chrome

This commit is contained in:
benfry
2011-04-17 16:55:18 +00:00
parent a20df9d687
commit 38fae0d442
2 changed files with 32 additions and 2 deletions
+28
View File
@@ -1423,6 +1423,10 @@ public class PApplet extends Applet
public void paint(Graphics screen) {
// int r = (int) random(10000);
// System.out.println("into paint " + r);
//super.paint(screen);
// ignore the very first call to paint, since it's coming
// from the o.s., and the applet will soon update itself anyway.
if (frameCount == 0) {
@@ -1432,6 +1436,20 @@ public class PApplet extends Applet
return;
}
// //MACOSX
// // every public entry point for drawing should
// // disable/enable flushing to avoid screen flickering
// sun.java2d.SurfaceData sd = null;
// if (platform == MACOSX) {
// if (screen instanceof sun.java2d.SunGraphics2D) {
// sd = ((sun.java2d.SunGraphics2D) screen).surfaceData;
// }
// if (sd != null) {
// sd.disableFlushing();
// }
// }
// try {
// without ignoring the first call, the first several frames
// are confused because paint() gets called in the midst of
// the initial nextFrame() call, so there are multiple
@@ -1453,6 +1471,16 @@ public class PApplet extends Applet
}
}
}
// System.out.println(" out paint " + r);
// } finally {
// if (platform == MACOSX) {
// if (sd != null) {
// sd.enableFlushing();
// }
// }
// }
}
@@ -182,8 +182,10 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
// don't copy the pixels/data elements of the buffered image directly,
// since it'll disable the nice speedy pipeline stuff, sending all drawing
// into a world of suck that's rough 6 trillion times slower.
image.getGraphics().drawImage(offscreen, 0, 0, null);
synchronized (image) {
//System.out.println("inside j2d sync");
image.getGraphics().drawImage(offscreen, 0, 0, null);
}
} else {
// TODO this is probably overkill for most tasks...
loadPixels();