diff options
-rw-r--r-- | make/scripts/tests.sh | 6 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java | 45 |
2 files changed, 18 insertions, 33 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 27ed1b710..3976c081d 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -36,7 +36,7 @@ function jrun() { #D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.EDT -Djogamp.debug.Lock" #D_ARGS="-Dnewt.debug.EDT" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all" - D_ARGS="-Djogl.debug=all" + #D_ARGS="-Djogl.debug=all" #D_ARGS="-Djogl.debug.GraphicsConfiguration" #X_ARGS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=true" java $awtarg $X_ARGS $D_ARGS $* 2>&1 | tee -a java-run.log @@ -82,7 +82,7 @@ function testawt() { #testawt com.jogamp.test.junit.jogl.awt.TestAWT02WindowClosing #testawt com.jogamp.test.junit.jogl.awt.TestSwingAWT01GLn #testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsAWT -testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT +#testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT #testawt com.jogamp.test.junit.jogl.texture.TestTexture01AWT # @@ -97,7 +97,7 @@ testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT #testawt com.jogamp.test.junit.newt.parenting.TestParenting01aAWT #testawt com.jogamp.test.junit.newt.parenting.TestParenting01bAWT #testawt com.jogamp.test.junit.newt.parenting.TestParenting01cAWT -#testawt com.jogamp.test.junit.newt.parenting.TestParenting01cSwingAWT +testawt com.jogamp.test.junit.newt.parenting.TestParenting01cSwingAWT #testawt com.jogamp.test.junit.newt.parenting.TestParenting02AWT #testawt com.jogamp.test.junit.newt.parenting.TestParenting03AWT #testawt com.jogamp.test.junit.newt.parenting.TestParenting03AWT -time 100000 diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index 65d6745ed..96cfe6562 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -92,18 +92,13 @@ public abstract class AnimatorBase implements GLAnimatorControl { if(DEBUG) { System.err.println("Animator add: "+drawable.hashCode()+" - "+Thread.currentThread()); } - // drawables list may be in use by display - stateSync.lock(); - try { - ArrayList newDrawables = (ArrayList) drawables.clone(); - newDrawables.add(drawable); - drawables = newDrawables; - drawablesEmpty = drawables.size() == 0; - drawable.setAnimator(this); - } finally { - stateSync.unlock(); + boolean paused = pause(); + drawables.add(drawable); + drawablesEmpty = drawables.size() == 0; + drawable.setAnimator(this); + if(paused) { + resume(); } - notifyAll(); if(!impl.skipWaitForCompletion(animThread)) { while(isStarted() && !isPaused() && !isAnimating()) { try { @@ -111,6 +106,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { } catch (InterruptedException ie) { } } } + notifyAll(); } public synchronized void remove(GLAutoDrawable drawable) { @@ -118,18 +114,13 @@ public abstract class AnimatorBase implements GLAnimatorControl { System.err.println("Animator remove: "+drawable.hashCode()+" - "+Thread.currentThread()); } - // drawables list may be in use by display - stateSync.lock(); - try { - ArrayList newDrawables = (ArrayList) drawables.clone(); - newDrawables.remove(drawable); - drawables = newDrawables; - drawablesEmpty = drawables.size() == 0; - drawable.setAnimator(null); - } finally { - stateSync.unlock(); + boolean paused = pause(); + drawables.remove(drawable); + drawablesEmpty = drawables.size() == 0; + drawable.setAnimator(null); + if(paused) { + resume(); } - notifyAll(); if(!impl.skipWaitForCompletion(animThread)) { while(isStarted() && drawablesEmpty && isAnimating()) { try { @@ -137,6 +128,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { } catch (InterruptedException ie) { } } } + notifyAll(); } /** Called every frame to cause redrawing of all of the @@ -145,14 +137,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { components this Animator manages, in particular when multiple lightweight widgets are continually being redrawn. */ protected void display() { - ArrayList dl; - stateSync.lock(); - try { - dl = drawables; - } finally { - stateSync.unlock(); - } - impl.display(dl, ignoreExceptions, printExceptions); + impl.display(drawables, ignoreExceptions, printExceptions); curTime = System.currentTimeMillis(); totalFrames++; } |