From 9a7c8896fe38ebcd42ed5238b09a7a36d46db9dc Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 30 Jun 2012 05:14:34 +0200 Subject: Fix Bug #589 (JAWT Offscreen-Layer resize) and Offscreen-Layer setSwapInterval() deadlock; Reuse JAWT instance; Cleanup - Fixes - OSXUtil.CreateCALayer*(..): Pass layer target size (if known). This fixes Bug #589 - MacOSXWindowSystemInterface-pbuffer.m: - ALL: displayLink NULL check - setSwapInterval(..): lock only for variable setting, could deadlock when start/stop CVDisplayLink - JAWTWindow.destroy(): use 'surfaceLock' instead of 'synchronized' - Cleanup / Performance - JAWTWindow.lockSurface(): Reuse JAWT instance - MacOSXJAWTWindow: AttachJAWTSurfaceLayer0(..) -> SetJAWTRootSurfaceLayer0(..) Reflects semantic better. - DEBUG - JAWTWindow.updateBounds(..) notify of bounds change --- .../junit/jogl/demos/es2/awt/TestGearsES2AWT.java | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java index c6e224548..ba9113af5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java @@ -32,6 +32,8 @@ import javax.media.opengl.*; import com.jogamp.opengl.util.Animator; import javax.media.opengl.awt.GLCanvas; + +import com.jogamp.common.os.Platform; import com.jogamp.newt.event.awt.AWTKeyAdapter; import com.jogamp.newt.event.awt.AWTWindowAdapter; import com.jogamp.newt.event.TraceKeyAdapter; @@ -41,7 +43,11 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; + +import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Frame; +import java.awt.TextArea; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -57,6 +63,7 @@ public class TestGearsES2AWT extends UITestCase { static boolean firstUIActionOnProcess = false; static boolean forceES2 = false; static boolean shallUseOffscreenLayer = false; + static boolean addComp = true; static int swapInterval = 1; static boolean showFPS = false; @@ -77,8 +84,19 @@ public class TestGearsES2AWT extends UITestCase { final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); glCanvas.setShallUseOffscreenLayer(shallUseOffscreenLayer); - frame.add(glCanvas); - frame.setSize(512, 512); + Dimension glc_sz = new Dimension(width, height); + glCanvas.setMinimumSize(glc_sz); + glCanvas.setPreferredSize(glc_sz); + glCanvas.setSize(glc_sz); + if(addComp) { + final TextArea ta = new TextArea(2, 20); + ta.append("0123456789"); + ta.append(Platform.getNewline()); + ta.append("Some Text"); + ta.append(Platform.getNewline()); + frame.add(ta, BorderLayout.SOUTH); + } + frame.add(glCanvas, BorderLayout.CENTER); frame.setTitle("Gears AWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval); glCanvas.addGLEventListener(new GearsES2(swapInterval)); @@ -91,12 +109,13 @@ public class TestGearsES2AWT extends UITestCase { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { + frame.pack(); frame.setVisible(true); }}); animator.setUpdateFPSFrames(60, System.err); animator.start(); - while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()