summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-03-14 11:26:10 +0100
committerSven Gothel <[email protected]>2013-03-14 11:26:10 +0100
commitdd705f1eb14b87b207e375ea0d71e00155a9933f (patch)
tree131c131ea2fff2298e2306326ceced93f578ae06 /src/jogl
parent896e8b021b39e9415040a57a1d540d7d24b02db1 (diff)
OSX/CALayer: Simplify FixCALayerLayout()/layoutSurfaceLayer() call, no more need for explicit call
- OffscreenLayerSurface.layoutSurfaceLayer() removed, no more required - JAWTWindow adds a ComponentListener, which issues FixCALayerLayout() at resized, moved and shown. - MyNSOpenGLLayer no more requires fix*Size() methods - MyNSOpenGLLayer::setDedicatedSize() need no explicit CATransaction, performed by caller.
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java8
-rw-r--r--src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m63
2 files changed, 4 insertions, 67 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 63c18db5d..278e2dc37 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -434,8 +434,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
_lock.lock();
try {
final GLDrawable _drawable = drawable;
- if( null == _drawable || realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) {
- return;
+ if( null == _drawable || realized == _drawable.isRealized() ||
+ realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) {
+ return;
}
_drawable.setRealized(realized);
if( realized && _drawable.isRealized() ) {
@@ -705,9 +706,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
sendReshape = true; // async if display() doesn't get called below, but avoiding deadlock
- if(null != jawtWindow && jawtWindow.isOffscreenLayerSurfaceEnabled() ) {
- jawtWindow.layoutSurfaceLayer();
- }
}
}
}
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
index f93f15241..125ca8af8 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
@@ -192,8 +192,6 @@ extern GLboolean glIsVertexArray (GLuint array);
- (void) applyNewPBuffer;
- (void)setDedicatedSize:(CGSize)size; // @NWDedicatedSize
-- (CGRect)fixMyFrame;
-- (CGRect)fixSuperPosition;
- (id<CAAction>)actionForKey:(NSString *)key ;
- (NSOpenGLPixelFormat *)openGLPixelFormatForDisplayMask:(uint32_t)mask;
- (NSOpenGLContext *)openGLContextForPixelFormat:(NSOpenGLPixelFormat *)pixelFormat;
@@ -364,14 +362,6 @@ static const GLfloat gl_verts[] = {
if(_texHeight != texHeight || _texWidth != texWidth) {
texWidth = _texWidth;
texHeight = _texHeight;
- /**
- CGRect lRect = [self bounds];
- lRect.origin.x = 0;
- lRect.origin.y = 0;
- lRect.size.width = texWidth;
- lRect.size.height = texHeight;
- [self setFrame: lRect]; */
- CGRect lRect = [self fixMyFrame];
GLfloat texCoordWidth, texCoordHeight;
if(NULL != pbuffer) {
@@ -394,13 +384,13 @@ static const GLfloat gl_verts[] = {
gl_texCoords[4] = texCoordWidth;
gl_texCoords[6] = texCoordWidth;
#ifdef VERBOSE_ON
+ CGRect lRect = [self bounds];
DBG_PRINT("MyNSOpenGLLayer::validateTexSize %p -> tex %dx%d, bounds: %lf/%lf %lfx%lf\n",
self, texWidth, texHeight,
lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
#endif
return YES;
} else {
- [self fixMyFrame];
return NO;
}
}
@@ -549,16 +539,11 @@ static const GLfloat gl_verts[] = {
DBG_PRINT("MyNSOpenGLLayer::setDedicatedSize: %p, texSize %dx%d <- %lfx%lf\n",
self, texWidth, texHeight, size.width, size.height);
- [CATransaction begin];
- [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
-
dedicatedWidth = size.width;
dedicatedHeight = size.height;
CGRect rect = CGRectMake(0, 0, dedicatedWidth, dedicatedHeight);
[self setFrame: rect];
-
- [CATransaction commit];
}
- (void) setFrame:(CGRect) frame {
@@ -566,52 +551,6 @@ static const GLfloat gl_verts[] = {
[super setFrame: rect];
}
-- (CGRect)fixMyFrame
-{
- CGRect lRect = [self frame];
-
- // With Java7 our root CALayer's frame gets off-limit -> force 0/0 origin!
- if( lRect.origin.x!=0 || lRect.origin.y!=0 || lRect.size.width!=texWidth || lRect.size.height!=texHeight) {
- DBG_PRINT("MyNSOpenGLLayer::fixMyFrame: %p, 0/0 texSize %dx%d -> Frame[%lf/%lf %lfx%lf]\n",
- self, texWidth, texHeight,
- lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
-
- [CATransaction begin];
- [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
-
- lRect.origin.x = 0;
- lRect.origin.y = 0;
- lRect.size.width=texWidth;
- lRect.size.height=texHeight;
- [self setFrame: lRect];
-
- [CATransaction commit];
- }
- return lRect;
-}
-
-- (CGRect)fixSuperPosition
-{
- CALayer * superL = [self superlayer];
- CGRect lRect = [superL frame];
-
- // With Java7 our root CALayer's frame gets off-limit -> force 0/0 origin!
- if( lRect.origin.x!=0 || lRect.origin.y!=0 ) {
- DBG_PRINT("MyNSOpenGLLayer::fixSuperPosition: %p, 0/0 -> Super Frame[%lf/%lf %lfx%lf]\n",
- self, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
-
- [CATransaction begin];
- [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
-
- lRect.origin.x = 0;
- lRect.origin.y = 0;
- [superL setPosition: lRect.origin];
-
- [CATransaction commit];
- }
- return lRect;
-}
-
- (id<CAAction>)actionForKey:(NSString *)key
{
DBG_PRINT("MyNSOpenGLLayer::actionForKey.0 %p key %s -> NIL\n", self, [key UTF8String]);