summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-13 14:27:53 +0100
committerSven Gothel <[email protected]>2012-02-13 14:27:53 +0100
commitbe91765959db646cca0b03537f140da9fecd7450 (patch)
tree211429df09b040018641b45751d0e721c716d330
parentf2bc8fe1f93b5a112093d9507bdb397e3b390215 (diff)
OSX CALayer fix for Java7 (force CALayer to 0/0, always remove all animations)
-rwxr-xr-xmake/scripts/tests.sh4
-rw-r--r--src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m20
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.m5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java23
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer02NewtCanvasAWT.java24
5 files changed, 59 insertions, 17 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 88d39dcdd..ec5109813 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -184,7 +184,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrentNEWT $*
@@ -332,7 +332,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT $*
# osx:
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLnAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
-#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT $*
+testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer02NewtCanvasAWT $*
$spath/count-edt-start.sh java-run.log
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m
index b713465f7..6071f9610 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m
@@ -102,9 +102,23 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink,
pthread_mutex_init(&renderLock, &renderLockAttr); // recursive
pthread_cond_init(&renderSignal, NULL); // no attribute
+ textureID = 0;
+ swapInterval = -1;
+ shallDraw = NO;
+ texWidth = _texWidth;
+ texHeight = _texHeight;
pbuffer = p;
[pbuffer retain];
+ {
+ CGRect lRect = CGRectMake(0, 0, texWidth, texHeight);
+ [self setFrame:lRect];
+
+ // no animations for add/remove/swap sublayers etc
+ // doesn't work: [self removeAnimationForKey: kCAOnOrderIn, kCAOnOrderOut, kCATransition]
+ [self removeAllAnimations];
+ }
+
// instantiate a deactivated displayLink
#ifdef HAS_CADisplayLink
displayLink = [[CVDisplayLink displayLinkWithTarget:self selector:@selector(setNeedsDisplay)] retain];
@@ -148,12 +162,8 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink,
[self setAsynchronous: YES];
[self setNeedsDisplayOnBoundsChange: YES]; // FIXME: learn how to recreate on size change!
+
[self setOpaque: opaque ? YES : NO];
- texWidth = _texWidth;
- texHeight = _texHeight;
- textureID = 0;
- swapInterval = -1;
- shallDraw = NO;
CGRect lRect = [self frame];
DBG_PRINT("MyNSOpenGLLayer::init %p, ctx %p, pfmt %p, pbuffer %p, opaque %d, pbuffer %dx%d -> tex %dx%d, frame: %lf/%lf %lfx%lf (refcnt %d)\n",
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index eec9b2a01..38ffde98b 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -242,6 +242,9 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0
lRect.size.width = 32;
lRect.size.height = 32;
[layer setFrame: lRect];
+ // no animations for add/remove/swap sublayers etc
+ // doesn't work: [layer removeAnimationForKey: kCAOnOrderIn, kCAOnOrderOut, kCATransition]
+ [layer removeAllAnimations];
DBG_PRINT("CALayer::CreateCALayer.1: %p %lf/%lf %lfx%lf\n", layer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
DBG_PRINT("CALayer::CreateCALayer.X: %p (refcnt %d)\n", layer, (int)[layer retainCount]);
@@ -265,7 +268,7 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
CGRect lRectRoot = [rootLayer frame];
DBG_PRINT("CALayer::AddCASublayer0.0: Origin %p frame0: %lf/%lf %lfx%lf\n",
rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
- if(lRectRoot.origin.x<0 || lRectRoot.origin.y<0) {
+ if(lRectRoot.origin.x!=0 || lRectRoot.origin.y!=0) {
lRectRoot.origin.x = 0;
lRectRoot.origin.y = 0;
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java
index 1367a27dd..8ec65bf50 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java
@@ -47,6 +47,7 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.jogamp.common.os.Platform;
import com.jogamp.newt.Window;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -103,10 +104,22 @@ public class TestParentingOffscreenLayer01GLCanvasAWT extends UITestCase {
w.destroy();
}
}
+
+ @Test
+ public void testInfo00() throws InterruptedException, InvocationTargetException {
+ System.err.println("Java Version: "+Platform.getJavaVersionNumber());
+ System.err.println("OS Version: "+Platform.getOSVersionNumber());
+ System.err.println("JAWTUtil.isOffscreenLayerRequired(): "+JAWTUtil.isOffscreenLayerRequired());
+ System.err.println("JAWTUtil.isOffscreenLayerSupported(): "+JAWTUtil.isOffscreenLayerSupported());
+ }
@Test
public void testOnscreenLayerGLCanvas_Onscreen() throws InterruptedException, InvocationTargetException {
- testOffscreenLayerGLCanvas_Impl(false, false);
+ if(!JAWTUtil.isOffscreenLayerRequired()) {
+ testOffscreenLayerGLCanvas_Impl(false, false);
+ } else {
+ System.err.println("onscreen layer n/a");
+ }
}
/** We have no GLCanvas OffscreenWindow as we have for NEWT .. test disabled.
@@ -116,8 +129,12 @@ public class TestParentingOffscreenLayer01GLCanvasAWT extends UITestCase {
} */
@Test
- public void testOffscreenLayerGLCanvas_OffscreenLayerWithOnscreenClass() throws InterruptedException, InvocationTargetException {
- testOffscreenLayerGLCanvas_Impl(true, false);
+ public void testOffscreenLayerGLCanvas_OffscreenLayerWithOnscreenClass() throws InterruptedException, InvocationTargetException {
+ if(JAWTUtil.isOffscreenLayerSupported()) {
+ testOffscreenLayerGLCanvas_Impl(true, false);
+ } else {
+ System.err.println("offscreen layer n/a");
+ }
}
private void testOffscreenLayerGLCanvas_Impl(boolean offscreenLayer, boolean offscreenClass) throws InterruptedException, InvocationTargetException {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer02NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer02NewtCanvasAWT.java
index bc59c7378..6a1980b90 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer02NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer02NewtCanvasAWT.java
@@ -106,17 +106,29 @@ public class TestParentingOffscreenLayer02NewtCanvasAWT extends UITestCase {
@Test
public void testOnscreenLayerNewtCanvas_Onscreen() throws InterruptedException, InvocationTargetException {
- testOffscreenLayerNewtCanvas_Impl(false, false);
+ if(!JAWTUtil.isOffscreenLayerRequired()) {
+ testOffscreenLayerNewtCanvas_Impl(false, false);
+ } else {
+ System.err.println("onscreen layer n/a");
+ }
}
- @Test
- public void testOffscreenLayerNewtCanvas_OffscreenLayerWithOffscreenClass() throws InterruptedException, InvocationTargetException {
- testOffscreenLayerNewtCanvas_Impl(true, true);
+ // @Test
+ public void testOffscreenLayerNewtCanvas_OffscreenLayerWithOffscreenClass() throws InterruptedException, InvocationTargetException {
+ if(JAWTUtil.isOffscreenLayerSupported()) {
+ testOffscreenLayerNewtCanvas_Impl(true, true);
+ } else {
+ System.err.println("offscreen layer n/a");
+ }
}
@Test
- public void testOffscreenLayerNewtCanvas_OffscreenLayerWithOnscreenClass() throws InterruptedException, InvocationTargetException {
- testOffscreenLayerNewtCanvas_Impl(true, false);
+ public void testOffscreenLayerNewtCanvas_OffscreenLayerWithOnscreenClass() throws InterruptedException, InvocationTargetException {
+ if(JAWTUtil.isOffscreenLayerSupported()) {
+ testOffscreenLayerNewtCanvas_Impl(true, false);
+ } else {
+ System.err.println("offscreen layer n/a");
+ }
}
private void testOffscreenLayerNewtCanvas_Impl(boolean offscreenLayer, boolean offscreenClass) throws InterruptedException, InvocationTargetException {