From 1822a28367e69aa63eb02017fe8cd333a1f5e64b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 7 Nov 2013 11:34:04 +0100 Subject: GLJPanel: Remove redundant !isInitialized [double-]check in initializeBackendImpl(), already tested before function entry! --- .../classes/javax/media/opengl/awt/GLJPanel.java | 62 ++++++++++------------ 1 file changed, 29 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 2c805fa00..e3d71302b 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -1068,45 +1068,41 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private final Object initSync = new Object(); private boolean initializeBackendImpl() { - if( !isInitialized ) { - synchronized(initSync) { - if( !isInitialized ) { - if ( 0 >= panelWidth || 0 >= panelHeight ) { - // See whether we have a non-zero size yet and can go ahead with - // initialization - if (0 >= reshapeWidth || 0 >= reshapeHeight ) { - return false; - } + synchronized(initSync) { + if( !isInitialized ) { + if ( 0 >= panelWidth || 0 >= panelHeight ) { + // See whether we have a non-zero size yet and can go ahead with + // initialization + if (0 >= reshapeWidth || 0 >= reshapeHeight ) { + return false; + } - if (DEBUG) { - System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight); - } - // Pull down reshapeWidth and reshapeHeight into panelWidth and - // panelHeight eagerly in order to complete initialization, and - // force a reshape later - panelWidth = reshapeWidth; - panelHeight = reshapeHeight; - } + if (DEBUG) { + System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight); + } + // Pull down reshapeWidth and reshapeHeight into panelWidth and + // panelHeight eagerly in order to complete initialization, and + // force a reshape later + panelWidth = reshapeWidth; + panelHeight = reshapeHeight; + } - if ( null == backend ) { - if ( oglPipelineUsable() ) { - backend = new J2DOGLBackend(); - } else { - backend = new OffscreenBackend(glProfile, customPixelBufferProvider); - } - isInitialized = false; + if ( null == backend ) { + if ( oglPipelineUsable() ) { + backend = new J2DOGLBackend(); + } else { + backend = new OffscreenBackend(glProfile, customPixelBufferProvider); } + isInitialized = false; + } - if (!isInitialized) { - backend.initialize(); - } - return isInitialized; - } else { - return true; + if (!isInitialized) { + backend.initialize(); } + return isInitialized; + } else { + return true; } - } else { - return true; } } -- cgit v1.2.3