fix chrome and firefox 4 animation stuttering

This commit is contained in:
benfry
2011-03-06 01:32:36 +00:00
parent ada279bb6d
commit a058e50230
2 changed files with 10 additions and 27 deletions
+4 -27
View File
@@ -1424,6 +1424,8 @@ public class PApplet extends Applet
//synchronized public void paint(Graphics screen) { // shutting off for 0146
public void paint(Graphics screen) {
println("non-active paint");
// 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) {
@@ -1452,28 +1454,6 @@ public class PApplet extends Applet
}
// active paint method
protected void paint() {
try {
Graphics screen = this.getGraphics();
if (screen != null) {
if ((g != null) && (g.image != null)) {
screen.drawImage(g.image, 0, 0, null);
}
Toolkit.getDefaultToolkit().sync();
}
} catch (Exception e) {
// Seen on applet destroy, maybe can ignore?
e.printStackTrace();
// } finally {
// if (g != null) {
// g.dispose();
// }
}
}
//////////////////////////////////////////////////////////////
@@ -1649,11 +1629,8 @@ public class PApplet extends Applet
frameRateLastNanos = now;
frameCount++;
// Actively render the screen
paint();
// repaint();
// getToolkit().sync(); // force repaint now (proper method)
repaint();
getToolkit().sync(); // force repaint now (proper method)
postMethods.handle();
}
+6
View File
@@ -1,4 +1,10 @@
0193 core
X fix problem that made applets suck in Google Chrome and Firefox 4
_ java.lang.OutOfMemoryError using get() and image() inside a tight loop
_ just need to swap out use of clone() since it's causing trouble
_ http://code.google.com/p/processing/issues/detail?id=42
_ need to finish font changes wrt native fonts before any release
_ right now not in a good place--default font will be bitmapped and ugly