aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-11-07 11:34:04 +0100
committerSven Gothel <[email protected]>2013-11-07 11:34:04 +0100
commit1822a28367e69aa63eb02017fe8cd333a1f5e64b (patch)
tree78bda5165b72ad1ac5604ba8dd5e5ff6b2202b93
parent3e1924e73d583d344b45839bed3a7bd51751a019 (diff)
GLJPanel: Remove redundant !isInitialized [double-]check in initializeBackendImpl(), already tested before function entry!
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java62
1 files changed, 29 insertions, 33 deletions
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;
}
}