summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-08 10:47:41 +0200
committerSven Gothel <[email protected]>2014-07-08 10:47:41 +0200
commit96d530e7127c89db9991080e6268c6e8430d0619 (patch)
treeefd8da06fea9da34f03c232d8c23670e41282d11
parentdb25b1ba6575210741e485838d0882a1590125e6 (diff)
Findbugs.not-written.null: Fix referencing non-written fields (never written or due branching)
- AWT TextRenderer: Add throw new InternalError("fontRenderContext never initialized!"); FIXME! - GLContextImpl.hasFBOImpl(): Fix serious NPE issue if extCache is null - GLDrawableFactoryImpl.createOffscreenDrawableImpl(..): - Fix NPE issue w/ null drawable - Fix resetting GammaRamp by ensuring originalGammaRamp will be set at 1st setGammaRamp(..) - AndroidGLMediaPlayerAPI14: Fix NPE: Use already resolved local referenced - EGLDrawableFactory: Fix NPE: Only operate on non null surface! - ALAudioSink.dequeueBuffer(..): Only resolve releasedBuffer elements if not null -
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java5
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java17
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java14
-rw-r--r--src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java13
10 files changed, 63 insertions, 39 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
index 660d3bc6a..1c9eacec0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -1582,7 +1582,7 @@ public class TextRenderer {
class GlyphProducer {
final int undefined = -2;
- FontRenderContext fontRenderContext;
+ FontRenderContext fontRenderContext = null; // FIXME: Never initialized!
List<Glyph> glyphsOutput = new ArrayList<Glyph>();
HashMap<String, GlyphVector> fullGlyphVectorCache = new HashMap<String, GlyphVector>();
HashMap<Character, GlyphMetrics> glyphMetricsCache = new HashMap<Character, GlyphMetrics>();
@@ -1675,6 +1675,9 @@ public class TextRenderer {
// Have to do this the hard / uncached way
singleUnicode[0] = unicodeID;
+ if( null == fontRenderContext ) { // FIXME: Never initialized!
+ throw new InternalError("fontRenderContext never initialized!");
+ }
final GlyphVector gv = font.createGlyphVector(fontRenderContext,
singleUnicode);
return gv.getGlyphMetrics(0).getAdvance();
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 9d2d21ce5..ec834e02f 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -413,7 +413,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
final AWTGraphicsConfiguration config = chooseGraphicsConfiguration( (GLCapabilitiesImmutable)awtConfig.getChosenCapabilities(),
(GLCapabilitiesImmutable)awtConfig.getRequestedCapabilities(),
chooser, gc.getDevice());
- final GraphicsConfiguration compatible = (null!=config)?config.getAWTGraphicsConfiguration():null;
+ final GraphicsConfiguration compatible = config.getAWTGraphicsConfiguration();
final boolean equalCaps = config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities());
if(DEBUG) {
System.err.println(getThreadName()+": Info:");
@@ -1513,7 +1513,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
- if (config == null) {
+ if ( null == config ) {
throw new GLException("Error: Couldn't fetch AWTGraphicsConfiguration");
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 8f75e7115..4da8684cf 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -281,11 +281,6 @@ public class VBORegion2PVBAAES2 extends GLRegion {
@Override
protected void updateImpl(final GL2ES2 gl) {
- if(null == indicesFbo) {
- if(Region.DEBUG_INSTANCE) {
- System.err.println("VBORegion2PVBAAES2 Create: " + this);
- }
- }
// seal buffers
indicesBuffer.seal(gl, true);
indicesBuffer.enableBuffer(gl, false);
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 5671334bd..832a797e2 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -177,7 +177,7 @@ public abstract class GLContextImpl extends GLContext {
glRendererLowerCase = glRenderer;
glVersion = glVendor;
- if (boundFBOTarget != null) { // <init>
+ if ( null != boundFBOTarget ) { // <init>: boundFBOTarget is not written yet
boundFBOTarget[0] = 0; // draw
boundFBOTarget[1] = 0; // read
}
@@ -1939,19 +1939,20 @@ public abstract class GLContextImpl extends GLContext {
}
private static final boolean hasFBOImpl(final int major, final int ctp, final ExtensionAvailabilityCache extCache) {
- return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0
+ return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0
- major >= 3 || // any >= 3.0 GL ctx (core, compat and ES)
+ major >= 3 || // any >= 3.0 GL ctx (core, compat and ES)
( null != extCache &&
+ (
+ extCache.isExtensionAvailable(GLExtensions.ARB_ES2_compatibility) || // ES 2.0 compatible
- extCache.isExtensionAvailable(GLExtensions.ARB_ES2_compatibility) || // ES 2.0 compatible
+ extCache.isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object
- extCache.isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object
+ extCache.isExtensionAvailable(GLExtensions.EXT_framebuffer_object) || // EXT_framebuffer_object
- extCache.isExtensionAvailable(GLExtensions.EXT_framebuffer_object) || // EXT_framebuffer_object
-
- extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded
+ extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) // OES_framebuffer_object
+ ) );
}
private final void removeCachedVersion(final int major, final int minor, int ctxProfileBits) {
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index fd8052b96..1aca29d0a 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -272,11 +272,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(capsRequested);
final GLDrawableImpl drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
new UpstreamSurfaceHookMutableSize(width, height) ) );
+ final GLContextImpl ctx;
if(null != drawable) {
drawable.setRealized(true);
+ ctx = (GLContextImpl) drawable.createContext(shareWith);
+ } else {
+ ctx = null;
}
-
- return new GLPbufferImpl( drawable, (GLContextImpl) drawable.createContext(shareWith) );
+ return new GLPbufferImpl( drawable, ctx);
}
//---------------------------------------------------------------------------
@@ -607,7 +610,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
rampEntry = 0.0f;
gammaRamp[i] = rampEntry;
}
- needsGammaRampReset = true;
+ if( !needsGammaRampReset ) {
+ originalGammaRamp = getGammaRamp();
+ needsGammaRampReset = true;
+ }
return setGammaRamp(gammaRamp);
}
diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
index 9aa1c882a..ea23b5239 100644
--- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
+++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
@@ -420,7 +420,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
// stex.getTransformMatrix(atex.getSTMatrix());
}
}
- nextFrame.setPTS( pts );
+ sTexFrame.setPTS( pts );
}
return pts;
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index c4ee4bf73..887bc1ba1 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -478,8 +478,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
downstreamSurface = createDummySurfaceImpl(defaultDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen
if( null != downstreamSurface ) {
downstreamSurface.createNotify();
+ surface = downstreamSurface;
}
- surface = downstreamSurface;
} else {
// 3rd case fake creation of defaultDevice shared resource, no pbuffer available
final List<GLCapabilitiesImmutable> capsAnyL = getAvailableEGLConfigs(defaultDevice, reqCapsAny);
@@ -499,14 +499,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
upstreamSurface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window
if(null != upstreamSurface) {
upstreamSurface.createNotify();
+ eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(surface);
+ eglDevice.open();
+ if( DEBUG ) {
+ dumpEGLInfo("EGLDrawableFactory.mapAvailableEGLESConfig: ", eglDevice.getHandle());
+ }
+ hasPBuffer[0] = true;
+ surface = upstreamSurface;
}
- surface = upstreamSurface;
- eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(surface);
- eglDevice.open();
- if( DEBUG ) {
- dumpEGLInfo("EGLDrawableFactory.mapAvailableEGLESConfig: ", eglDevice.getHandle());
- }
- hasPBuffer[0] = true;
}
if(null != surface) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
index 305899fff..cc15f0cd6 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
@@ -217,8 +217,18 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
@Override
public String toString() {
- final String us_s = null != upstreamSurface ? ( upstreamSurface.getClass().getName() + ": 0x" + Long.toHexString(upstreamSurface.getSurfaceHandle()) ) : "nil";
- return "EGLUpstreamSurfaceHook[ "+ upstreamSurface.getSurfaceWidth() + "x" + upstreamSurface.getSurfaceHeight() + ", " + us_s+ "]";
+ final String us_s;
+ final int sw, sh;
+ if( null != upstreamSurface ) {
+ us_s = upstreamSurface.getClass().getName() + ": 0x" + Long.toHexString(upstreamSurface.getSurfaceHandle());
+ sw = upstreamSurface.getSurfaceWidth();
+ sh = upstreamSurface.getSurfaceHeight();
+ } else {
+ us_s = "nil";
+ sw = -1;
+ sh = -1;
+ }
+ return "EGLUpstreamSurfaceHook[ "+ sw + "x" + sh + ", " + us_s+ "]";
}
}
diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
index b6ffced9f..ac55fcf98 100644
--- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
@@ -617,13 +617,13 @@ public class ALAudioSink implements AudioSink {
throw new InternalError("Buffer name mismatch: dequeued: "+buffers[i]+", released "+releasedBuffer+", "+this);
}
}
- }
- alBufferBytesQueued -= releasedBuffer.getByteSize();
- if( !alFramesAvail.put(releasedBuffer) ) {
- throw new InternalError("Internal Error: "+this);
- }
- if(DEBUG_TRACE) {
- System.err.println("<< [al "+buffers[i]+", q "+releasedBuffer.alBuffer+"] <- "+shortString()+" @ "+getThreadName());
+ alBufferBytesQueued -= releasedBuffer.getByteSize();
+ if( !alFramesAvail.put(releasedBuffer) ) {
+ throw new InternalError("Internal Error: "+this);
+ }
+ if(DEBUG_TRACE) {
+ System.err.println("<< [al "+buffers[i]+", q "+releasedBuffer.alBuffer+"] <- "+shortString()+" @ "+getThreadName());
+ }
}
}
}
diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
index 4d5d9724a..af5590be6 100644
--- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
@@ -83,9 +83,18 @@ public class SWTEDTUtil implements EDTUtil {
synchronized(edtLock) {
if( nedt.isRunning() ) {
final Thread curT = Thread.currentThread();
- final Thread swtT = !swtDisposed ? swtDisplay.getThread() : null;
+ final String swtTName;
+ final Thread swtT;
+ if( !swtDisposed ) {
+ swtT = swtDisplay.getThread();
+ swtTName = swtT.getName();
+ } else {
+ swtT = null;
+ swtTName = null;
+ }
final boolean onSWTEDT = swtT == curT;
- throw new IllegalStateException("EDT still running and not subject to stop. Curr "+curT.getName()+", NEDT "+nedt.getName()+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop+", SWT-EDT "+swtT.getName()+", on SWT-EDT "+onSWTEDT);
+ throw new IllegalStateException("EDT still running and not subject to stop. Curr "+curT.getName()+
+ ", NEDT "+nedt.getName()+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop+", SWT-EDT "+swtTName+", on SWT-EDT "+onSWTEDT);
}
if(DEBUG) {
System.err.println(Thread.currentThread()+": SWT-EDT reset - edt: "+nedt+", swtDisposed (skipping) "+swtDisposed);