From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:21:36 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- .../egl/DesktopES2DynamicLibraryBundleInfo.java | 6 +- src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 40 ++++---- .../classes/jogamp/opengl/egl/EGLDisplayUtil.java | 28 +++--- .../classes/jogamp/opengl/egl/EGLDrawable.java | 6 +- .../jogamp/opengl/egl/EGLDrawableFactory.java | 104 +++++++++++---------- .../opengl/egl/EGLDummyUpstreamSurfaceHook.java | 6 +- .../opengl/egl/EGLDynamicLibraryBundleInfo.java | 11 ++- .../jogamp/opengl/egl/EGLExternalContext.java | 2 +- .../jogamp/opengl/egl/EGLGLCapabilities.java | 14 +-- .../opengl/egl/EGLGraphicsConfiguration.java | 26 +++--- .../egl/EGLGraphicsConfigurationFactory.java | 46 ++++----- .../jogamp/opengl/egl/EGLOnscreenDrawable.java | 6 +- .../jogamp/opengl/egl/EGLPbufferDrawable.java | 6 +- .../jogamp/opengl/egl/EGLUpstreamSurfaceHook.java | 14 +-- .../jogamp/opengl/egl/EGLWrappedSurface.java | 4 +- 15 files changed, 161 insertions(+), 158 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/egl') diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java index 7b85c3e75..8c6091273 100644 --- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java @@ -49,18 +49,18 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu @Override public final List getToolGetProcAddressFuncNameList() { - List res = new ArrayList(); + final List res = new ArrayList(); res.add("eglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return true; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index da1c8aa47..964401244 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -65,13 +65,13 @@ public class EGLContext extends GLContextImpl { // EGL extension functions. private EGLExtProcAddressTable eglExtProcAddressTable; - EGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + EGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { eglQueryStringInitialized = false; eglQueryStringAvailable = false; eglExtProcAddressTable = null; @@ -140,12 +140,12 @@ public class EGLContext extends GLContextImpl { } @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { return 0; // FIXME } @Override - protected void destroyContextARBImpl(long _context) { + protected void destroyContextARBImpl(final long _context) { if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), _context)) { final int eglError = EGL.eglGetError(); if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */ @@ -175,7 +175,7 @@ public class EGLContext extends GLContextImpl { if( !EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API) ) { throw new GLException("Caught: eglBindAPI to ES failed , error "+toHexString(EGL.eglGetError())); } - } catch (GLException glex) { + } catch (final GLException glex) { if (DEBUG) { glex.printStackTrace(); } @@ -272,7 +272,7 @@ public class EGLContext extends GLContextImpl { @Override protected final StringBuilder getPlatformExtensionsStringImpl() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); if (!eglQueryStringInitialized) { eglQueryStringAvailable = getDrawableImpl().getGLDynamicLookupHelper().isFunctionAvailable("eglQueryString"); eglQueryStringInitialized = true; @@ -288,7 +288,7 @@ public class EGLContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { if( hasRendererQuirk(GLRendererQuirks.NoSetSwapInterval) ) { return false; } @@ -299,11 +299,11 @@ public class EGLContext extends GLContextImpl { // Accessible .. // - /* pp */ void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) { + /* pp */ void mapCurrentAvailableGLVersion(final AbstractGraphicsDevice device) { mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); } /* pp */ int getContextOptions() { return ctxOptions; } - /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) { + /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps) { final GLProfile glp = caps.getGLProfile(); final int[] reqMajorCTP = new int[2]; GLContext.getRequestMajorAndCompat(glp, reqMajorCTP); @@ -319,7 +319,7 @@ public class EGLContext extends GLContextImpl { } mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); } - /* pp */ static void mapStaticGLVersion(AbstractGraphicsDevice device, int major, int minor, int ctp) { + /* pp */ static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) { if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) { // ES1, ES2, ES3, .. mapStaticGLVersion(device, major /* reqMajor */, major, minor, ctp); @@ -329,28 +329,28 @@ public class EGLContext extends GLContextImpl { } } } - private static void mapStaticGLVersion(AbstractGraphicsDevice device, int reqMajor, int major, int minor, int ctp) { + private static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) { GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); if(! ( device instanceof EGLGraphicsDevice ) ) { final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); GLContext.mapAvailableGLVersion(eglDevice, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); } } - protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { + protected static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version) { return GLContext.getGLVersion(major, minor, ctp, gl_version); } - protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) { return GLContext.getAvailableGLVersionsSet(device); } - protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { GLContext.setAvailableGLVersionsSet(device); } - protected static String toHexString(int hex) { + protected static String toHexString(final int hex) { return GLContext.toHexString(hex); } - protected static String toHexString(long hex) { + protected static String toHexString(final long hex) { return GLContext.toHexString(hex); } @@ -359,17 +359,17 @@ public class EGLContext extends GLContextImpl { // @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { throw new GLException("Not yet implemented"); } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { throw new GLException("Should not call this"); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index c5f76f667..9499c70f4 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -75,7 +75,7 @@ public class EGLDisplayUtil { *

*/ static EGLDisplayRef getOrCreateOpened(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { - EGLDisplayRef o = (EGLDisplayRef) openEGLDisplays.get(eglDisplay); + final EGLDisplayRef o = (EGLDisplayRef) openEGLDisplays.get(eglDisplay); if( null == o ) { if( EGL.eglInitialize(eglDisplay, major, minor) ) { final EGLDisplayRef n = new EGLDisplayRef(eglDisplay); @@ -123,7 +123,7 @@ public class EGLDisplayUtil { return o; } - private EGLDisplayRef(long eglDisplay) { + private EGLDisplayRef(final long eglDisplay) { this.eglDisplay = eglDisplay; this.initRefCount = 0; this.createdStack = DEBUG ? new Throwable() : null; @@ -144,7 +144,7 @@ public class EGLDisplayUtil { /** * @return number of unclosed EGL Displays.
*/ - public static int shutdown(boolean verbose) { + public static int shutdown(final boolean verbose) { if(DEBUG || verbose || openEGLDisplays.size() > 0 ) { System.err.println("EGLDisplayUtil.EGLDisplays: Shutdown (open: "+openEGLDisplays.size()+")"); if(DEBUG) { @@ -160,7 +160,7 @@ public class EGLDisplayUtil { public static void dumpOpenDisplayConnections() { System.err.println("EGLDisplayUtil: Open EGL Display Connections: "+openEGLDisplays.size()); int i=0; - for(Iterator iter = openEGLDisplays.iterator(); iter.hasNext(); i++) { + for(final Iterator iter = openEGLDisplays.iterator(); iter.hasNext(); i++) { final LongObjectHashMap.Entry e = iter.next(); final EGLDisplayRef v = (EGLDisplayRef) e.value; System.err.println("EGLDisplayUtil: Open["+i+"]: 0x"+Long.toHexString(e.key)+": "+v); @@ -170,9 +170,9 @@ public class EGLDisplayUtil { } } - /* pp */ static synchronized void setSingletonEGLDisplayOnly(boolean v) { useSingletonEGLDisplay = v; } + /* pp */ static synchronized void setSingletonEGLDisplayOnly(final boolean v) { useSingletonEGLDisplay = v; } - private static synchronized long eglGetDisplay(long nativeDisplay_id) { + private static synchronized long eglGetDisplay(final long nativeDisplay_id) { if( useSingletonEGLDisplay && null != singletonEGLDisplay ) { if(DEBUG) { System.err.println("EGLDisplayUtil.eglGetDisplay.s: eglDisplay("+EGLContext.toHexString(nativeDisplay_id)+"): "+ @@ -198,7 +198,7 @@ public class EGLDisplayUtil { * * @see EGL#eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) { + private static synchronized boolean eglInitialize(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -222,7 +222,7 @@ public class EGLDisplayUtil { * @see #eglGetDisplay(long) * @see #eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized int eglGetDisplayAndInitialize(long nativeDisplayID, long[] eglDisplay, int[] eglErr, IntBuffer major, IntBuffer minor) { + private static synchronized int eglGetDisplayAndInitialize(final long nativeDisplayID, final long[] eglDisplay, final int[] eglErr, final IntBuffer major, final IntBuffer minor) { eglDisplay[0] = EGL.EGL_NO_DISPLAY; final long _eglDisplay = eglGetDisplay( nativeDisplayID ); if ( EGL.EGL_NO_DISPLAY == _eglDisplay ) { @@ -247,7 +247,7 @@ public class EGLDisplayUtil { * @return the initialized EGL display ID * @throws GLException if not successful */ - private static synchronized long eglGetDisplayAndInitialize(long[] nativeDisplayID) { + private static synchronized long eglGetDisplayAndInitialize(final long[] nativeDisplayID) { final long[] eglDisplay = new long[1]; final int[] eglError = new int[1]; int eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(nativeDisplayID[0], eglDisplay, eglError, null, null); @@ -271,7 +271,7 @@ public class EGLDisplayUtil { * @param eglDisplay the EGL display handle * @return true if the eglDisplay is valid and it's reference counter becomes zero and {@link EGL#eglTerminate(long)} was successful, otherwise false */ - private static synchronized boolean eglTerminate(long eglDisplay) { + private static synchronized boolean eglTerminate(final long eglDisplay) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -286,11 +286,11 @@ public class EGLDisplayUtil { private static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() { @Override - public long eglGetAndInitDisplay(long[] nativeDisplayID) { + public long eglGetAndInitDisplay(final long[] nativeDisplayID) { return eglGetDisplayAndInitialize(nativeDisplayID); } @Override - public void eglTerminate(long eglDisplayHandle) { + public void eglTerminate(final long eglDisplayHandle) { EGLDisplayUtil.eglTerminate(eglDisplayHandle); } }; @@ -309,7 +309,7 @@ public class EGLDisplayUtil { * @param unitID * @return an uninitialized {@link EGLGraphicsDevice} */ - public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID) { + public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(final long nativeDisplayID, final String connection, final int unitID) { return new EGLGraphicsDevice(nativeDisplayID, EGL.EGL_NO_DISPLAY, connection, unitID, eglLifecycleCallback); } @@ -325,7 +325,7 @@ public class EGLDisplayUtil { * @param surface * @return an uninitialized EGLGraphicsDevice */ - public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(NativeSurface surface) { + public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(final NativeSurface surface) { final long nativeDisplayID; if( NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false) ) { nativeDisplayID = surface.getSurfaceHandle(); // don't even ask .. diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index 76c6e5beb..bacf9f18e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -52,7 +52,7 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public abstract class EGLDrawable extends GLDrawableImpl { - protected EGLDrawable(EGLDrawableFactory factory, NativeSurface component) throws GLException { + protected EGLDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException { super(factory, component, false); } @@ -131,7 +131,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } } - protected static boolean isValidEGLSurface(long eglDisplayHandle, long surfaceHandle) { + protected static boolean isValidEGLSurface(final long eglDisplayHandle, final long surfaceHandle) { if( 0 == surfaceHandle ) { return false; } @@ -154,7 +154,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) surface.getGraphicsConfiguration().getScreen().getDevice(); // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers() diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index e50cb7262..71e5afe33 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -65,6 +65,7 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; +import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; @@ -77,6 +78,7 @@ import jogamp.opengl.SharedResourceRunner; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; @@ -88,14 +90,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { static { Debug.initSingleton(); - QUERY_EGL_ES_NATIVE_TK = Debug.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); + QUERY_EGL_ES_NATIVE_TK = PropertyAccess.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); } private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null; private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null; - private static final boolean isANGLE(GLDynamicLookupHelper dl) { - if(Platform.OSType.WINDOWS == Platform.OS_TYPE) { + private static final boolean isANGLE(final GLDynamicLookupHelper dl) { + if(Platform.OSType.WINDOWS == PlatformPropsImpl.OS_TYPE) { return dl.isFunctionAvailable("eglQuerySurfacePointerANGLE") || dl.isFunctionAvailable("glBlitFramebufferANGLE") || dl.isFunctionAvailable("glRenderbufferStorageMultisampleANGLE"); @@ -104,7 +106,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - private static final boolean includesES1(GLDynamicLookupHelper dl) { + private static final boolean includesES1(final GLDynamicLookupHelper dl) { return dl.isFunctionAvailable("glLoadIdentity") && dl.isFunctionAvailable("glEnableClientState") && dl.isFunctionAvailable("glColorPointer"); @@ -122,7 +124,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { hasX11 = true; try { ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader()); - } catch (Exception jre) { /* n/a .. */ } + } catch (final Exception jre) { /* n/a .. */ } } // FIXME: Probably need to move EGL from a static model @@ -136,7 +138,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -157,7 +159,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES2DynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -214,9 +216,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(DEBUG) { dumpMap(); } - Collection srl = sharedMap.values(); - for(Iterator sri = srl.iterator(); sri.hasNext(); ) { - SharedResource sr = sri.next(); + final Collection srl = sharedMap.values(); + for(final Iterator sri = srl.iterator(); sri.hasNext(); ) { + final SharedResource sr = sri.next(); if(DEBUG) { System.err.println("EGLDrawableFactory.shutdown: "+sr.device.toString()); } @@ -253,10 +255,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { synchronized(sharedMap) { System.err.println("EGLDrawableFactory.map "+sharedMap.size()); int i=0; - Set keys = sharedMap.keySet(); - for(Iterator keyI = keys.iterator(); keyI.hasNext(); i++) { - String key = keyI.next(); - SharedResource sr = sharedMap.get(key); + final Set keys = sharedMap.keySet(); + for(final Iterator keyI = keys.iterator(); keyI.hasNext(); i++) { + final String key = keyI.next(); + final SharedResource sr = sharedMap.get(key); System.err.println("EGLDrawableFactory.map["+i+"] "+key+" -> "+sr.getDevice()+", "+ "es1 [avail "+sr.wasES1ContextCreated+", pbuffer "+sr.hasPBufferES1+", quirks "+sr.rendererQuirksES1+", ctp "+EGLContext.getGLVersion(1, 0, sr.ctpES1, null)+"], "+ "es2/3 [es2 "+sr.wasES2ContextCreated+", es3 "+sr.wasES3ContextCreated+", [pbuffer "+sr.hasPBufferES3ES2+", quirks "+sr.rendererQuirksES3ES2+", ctp "+EGLContext.getGLVersion(2, 0, sr.ctpES3ES2, null)+"]]"); @@ -287,10 +289,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { private final boolean hasPBufferES1; private final boolean hasPBufferES3ES2; - SharedResource(EGLGraphicsDevice dev, - boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1, - boolean wasContextES2Created, boolean wasContextES3Created, - boolean hasPBufferES3ES2, GLRendererQuirks rendererQuirksES3ES2, int ctpES3ES2) { + SharedResource(final EGLGraphicsDevice dev, + final boolean wasContextES1Created, final boolean hasPBufferES1, final GLRendererQuirks rendererQuirksES1, final int ctpES1, + final boolean wasContextES2Created, final boolean wasContextES3Created, + final boolean hasPBufferES3ES2, final GLRendererQuirks rendererQuirksES3ES2, final int ctpES3ES2) { this.device = dev; // this.contextES1 = ctxES1; this.wasES1ContextCreated = wasContextES1Created; @@ -340,12 +342,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types. return null != sharedMap ; // null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper; } - private static List getAvailableEGLConfigs(EGLGraphicsDevice eglDisplay, GLCapabilitiesImmutable caps) { + private static List getAvailableEGLConfigs(final EGLGraphicsDevice eglDisplay, final GLCapabilitiesImmutable caps) { final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) { throw new GLException("EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "+EGLContext.toHexString(EGL.eglGetError())); @@ -368,8 +370,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { System.err.println(prefix+"EGL vendor "+eglVendor+", version "+eglVersion+", clientAPIs "+eglClientAPIs); } - private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int[] esProfile, - boolean[] hasPBuffer, GLRendererQuirks[] rendererQuirks, int[] ctp) { + private boolean mapAvailableEGLESConfig(final AbstractGraphicsDevice adevice, final int[] esProfile, + final boolean[] hasPBuffer, final GLRendererQuirks[] rendererQuirks, final int[] ctp) { final String profileString; switch( esProfile[0] ) { case 3: @@ -532,7 +534,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } } - } catch (Throwable t) { + } catch (final Throwable t) { if (DEBUG) { System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: INFO: context create/makeCurrent failed"); t.printStackTrace(); @@ -543,7 +545,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } drawable.setRealized(false); } - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); @@ -565,7 +567,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return success; } - private final boolean needsToCreateSharedResource(String key, SharedResource[] existing) { + private final boolean needsToCreateSharedResource(final String key, final SharedResource[] existing) { synchronized(sharedMap) { final SharedResource sr = sharedMap.get(key); if( null == sr ) { @@ -584,7 +586,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper return null; } @@ -617,16 +619,16 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - private SharedResource createEGLSharedResourceImpl(AbstractGraphicsDevice adevice) { + private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) { final boolean madeCurrentES1; - boolean[] hasPBufferES1 = new boolean[] { false }; - boolean[] hasPBufferES3ES2 = new boolean[] { false }; + final boolean[] hasPBufferES1 = new boolean[] { false }; + final boolean[] hasPBufferES3ES2 = new boolean[] { false }; // EGLContext[] eglCtxES1 = new EGLContext[] { null }; // EGLContext[] eglCtxES2 = new EGLContext[] { null }; - GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; - GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; - int[] ctpES1 = new int[] { -1 }; - int[] ctpES3ES2 = new int[] { -1 }; + final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; + final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; + final int[] ctpES1 = new int[] { -1 }; + final int[] ctpES3ES2 = new int[] { -1 }; if (DEBUG) { @@ -682,7 +684,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return sr; } - private void handleDontCloseX11DisplayQuirk(GLRendererQuirks quirks) { + private void handleDontCloseX11DisplayQuirk(final GLRendererQuirks quirks) { if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) { jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable(); } @@ -698,7 +700,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int esProfile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int esProfile) { if ( 2==esProfile || 3==esProfile ) { return eglES2DynamicLookupHelper; } else if (1==esProfile) { @@ -709,7 +711,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper return new ArrayList(); // null } @@ -717,7 +719,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -725,12 +727,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { throw new GLException("Non pbuffer not yet implemented"); } @@ -739,16 +741,16 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { // SharedResource sr = getOrCreateEGLSharedResource(device); // return sr.hasES1PBuffer() || sr.hasES2PBuffer(); return true; } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final boolean ownDevice; final EGLGraphicsDevice device; if( createNewDevice || ! (deviceReq instanceof EGLGraphicsDevice) ) { @@ -770,8 +772,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height)); } @@ -782,10 +784,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { * @param useTexture * @return the passed {@link MutableSurface} which now has the EGL pbuffer surface set as it's handle */ - protected static MutableSurface createPBufferSurfaceImpl(MutableSurface ms, boolean useTexture) { + protected static MutableSurface createPBufferSurfaceImpl(final MutableSurface ms, final boolean useTexture) { return null; } - protected static long createPBufferSurfaceImpl(EGLGraphicsConfiguration config, int width, int height, boolean useTexture) { + protected static long createPBufferSurfaceImpl(final EGLGraphicsConfiguration config, final int width, final int height, final boolean useTexture) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) config.getScreen().getDevice(); final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final int texFormat; @@ -811,7 +813,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final EGLGraphicsDevice eglDeviceReq = (EGLGraphicsDevice) deviceReq; final EGLGraphicsDevice device = EGLDisplayUtil.eglCreateEGLGraphicsDevice(eglDeviceReq.getNativeDisplayID(), deviceReq.getConnection(), deviceReq.getUnitID()); device.open(); @@ -822,12 +824,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { @Override protected GLContext createExternalGLContextImpl() { - AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL); + final AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL); return new EGLExternalContext(absScreen); } @Override - public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return false; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 205a94951..f00d7059d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -17,12 +17,12 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize * not the actual dummy surface height, * The latter is platform specific and small */ - public EGLDummyUpstreamSurfaceHook(int width, int height) { + public EGLDummyUpstreamSurfaceHook(final int width, final int height) { super(width, height); } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); eglDevice.lock(); try { @@ -41,7 +41,7 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); if( EGL.EGL_NO_SURFACE == s.getSurfaceHandle() ) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index ebe8f49c8..05dae0b9d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -33,6 +33,7 @@ import com.jogamp.common.os.Platform; import java.util.*; +import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.*; /** @@ -61,7 +62,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle */ @Override public final boolean shallLookupGlobal() { - if ( Platform.OSType.ANDROID == Platform.OS_TYPE ) { + if ( Platform.OSType.ANDROID == PlatformPropsImpl.OS_TYPE ) { // Android requires global symbol lookup return true; } @@ -71,18 +72,18 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle @Override public final List getToolGetProcAddressFuncNameList() { - List res = new ArrayList(); + final List res = new ArrayList(); res.add("eglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { if ( AndroidVersion.isAvailable ) { // Android requires global dlsym lookup return false; @@ -92,7 +93,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle } protected final List getEGLLibNamesList() { - List eglLibNames = new ArrayList(); + final List eglLibNames = new ArrayList(); // this is the default EGL lib name, according to the spec eglLibNames.add("libEGL.so.1"); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java index aff18fc81..babea4240 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java @@ -43,7 +43,7 @@ import javax.media.nativewindow.*; public class EGLExternalContext extends EGLContext { - public EGLExternalContext(AbstractGraphicsScreen screen) { + public EGLExternalContext(final AbstractGraphicsScreen screen) { super(null, null); GLContextShareSet.contextCreated(this); if( !setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_ES, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index e28b53235..a8dd7d5c8 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -52,7 +52,7 @@ public class EGLGLCapabilities extends GLCapabilities { * * May throw GLException if given GLProfile is not compatible w/ renderableType */ - public EGLGLCapabilities(long eglcfg, int eglcfgid, int visualID, GLProfile glp, int renderableType) { + public EGLGLCapabilities(final long eglcfg, final int eglcfgid, final int visualID, final GLProfile glp, final int renderableType) { super( glp ); this.eglcfg = eglcfg; this.eglcfgid = eglcfgid; @@ -73,19 +73,19 @@ public class EGLGLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } - final protected void setEGLConfig(long v) { eglcfg=v; } + final protected void setEGLConfig(final long v) { eglcfg=v; } final public long getEGLConfig() { return eglcfg; } final public int getEGLConfigID() { return eglcfgid; } final public int getRenderableType() { return renderableType; } final public int getNativeVisualID() { return nativeVisualID; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case EGL_CONFIG: @@ -97,7 +97,7 @@ public class EGLGLCapabilities extends GLCapabilities { } } - public static boolean isCompatible(GLProfile glp, int renderableType) { + public static boolean isCompatible(final GLProfile glp, final int renderableType) { if(null == glp) { return true; } @@ -116,7 +116,7 @@ public class EGLGLCapabilities extends GLCapabilities { return false; } - public static GLProfile getCompatible(EGLGraphicsDevice device, int renderableType) { + public static GLProfile getCompatible(final EGLGraphicsDevice device, final int renderableType) { if(0 != (renderableType & EGLExt.EGL_OPENGL_ES3_BIT_KHR) && GLProfile.isAvailable(device, GLProfile.GLES3)) { return GLProfile.get(device, GLProfile.GLES3); } @@ -132,7 +132,7 @@ public class EGLGLCapabilities extends GLCapabilities { return null; } - public static StringBuilder renderableTypeToString(StringBuilder sink, int renderableType) { + public static StringBuilder renderableTypeToString(StringBuilder sink, final int renderableType) { if(null == sink) { sink = new StringBuilder(); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index 88ed0be92..1d90e63af 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -72,8 +72,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfigID(); } - EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, - EGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + EGLGraphicsConfiguration(final AbstractGraphicsScreen absScreen, + final EGLGLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { super(absScreen, capsChosen, capsRequested); this.chooser = chooser; } @@ -85,7 +85,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @return * @throws GLException if invalid EGL display. */ - public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) { + public static EGLGraphicsConfiguration create(final GLCapabilitiesImmutable capsRequested, final AbstractGraphicsScreen absScreen, final int eglConfigID) { final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) { throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice"); @@ -110,8 +110,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } void updateGraphicsConfiguration() { - CapabilitiesImmutable capsChosen = getChosenCapabilities(); - EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) + final CapabilitiesImmutable capsChosen = getChosenCapabilities(); + final EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), capsChosen).chooseGraphicsConfiguration( capsChosen, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED); if(null!=newConfig) { @@ -123,7 +123,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } } - public static long EGLConfigId2EGLConfig(long display, int configID) { + public static long EGLConfigId2EGLConfig(final long display, final int configID) { final IntBuffer attrs = Buffers.newDirectIntBuffer(new int[] { EGL.EGL_CONFIG_ID, configID, EGL.EGL_NONE @@ -142,7 +142,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return configs.get(0); } - public static boolean isEGLConfigValid(long display, long config) { + public static boolean isEGLConfigValid(final long display, final long config) { if(0 == config) { return false; } @@ -190,8 +190,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @param forceTransparentFlag * @return */ - public static EGLGLCapabilities EGLConfig2Capabilities(GLRendererQuirks defaultQuirks, EGLGraphicsDevice device, GLProfile glp, - long config, int winattrmask, boolean forceTransparentFlag) { + public static EGLGLCapabilities EGLConfig2Capabilities(final GLRendererQuirks defaultQuirks, final EGLGraphicsDevice device, GLProfile glp, + final long config, final int winattrmask, final boolean forceTransparentFlag) { final long display = device.getHandle(); final int cfgID; final int rType; @@ -267,7 +267,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return null; } caps = new EGLGLCapabilities(config, cfgID, visualID, glp, rType); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("config "+toHexString(config)+": "+gle); } @@ -381,7 +381,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } - public static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps) { + public static IntBuffer GLCapabilities2AttribList(final GLCapabilitiesImmutable caps) { final IntBuffer attrs = Buffers.newDirectIntBuffer(32); int idx=0; @@ -480,8 +480,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return attrs; } - public static IntBuffer CreatePBufferSurfaceAttribList(int width, int height, int texFormat) { - IntBuffer attrs = Buffers.newDirectIntBuffer(16); + public static IntBuffer CreatePBufferSurfaceAttribList(final int width, final int height, final int texFormat) { + final IntBuffer attrs = Buffers.newDirectIntBuffer(16); int idx=0; attrs.put(idx++, EGL.EGL_WIDTH); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index 5cfa378cb..9962c0617 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -77,7 +77,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact static GraphicsConfigurationFactory fallbackGraphicsConfigurationFactory = null; static void registerFactory() { - GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); + final GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); // become the pre-selector for X11/.. to match the native visual id w/ EGL, if native ES is selected final String nwType = NativeWindowFactory.getNativeWindowType(false); @@ -117,8 +117,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl ( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (absScreen == null) { throw new IllegalArgumentException("This NativeWindowFactory accepts only AbstractGraphicsDevice objects"); } @@ -137,7 +137,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } - AbstractGraphicsDevice absDevice = absScreen.getDevice(); + final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } @@ -181,7 +181,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact return cfg; } - protected static List getAvailableCapabilities(EGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List getAvailableCapabilities(final EGLDrawableFactory factory, final AbstractGraphicsDevice device) { final EGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); @@ -192,7 +192,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("null eglDisplay"); } List availableCaps = null; - IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); + final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) { throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -201,7 +201,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) no configs"); } - PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); + final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs)) { throw new GLException("Graphics configuration get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -216,10 +216,10 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } public static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, int nativeVisualID, - boolean forceTransparentFlag) { + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, final int nativeVisualID, + final boolean forceTransparentFlag) { if (capsChosen == null) { capsChosen = new GLCapabilities(null); } @@ -227,7 +227,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null==absScreen) { throw new GLException("Null AbstractGraphicsScreen"); } - AbstractGraphicsDevice absDevice = absScreen.getDevice(); + final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } @@ -323,18 +323,18 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } - static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, - int nativeVisualID, boolean forceTransparentFlag) { + static EGLGraphicsConfiguration eglChooseConfig(final EGLGraphicsDevice device, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, + final int nativeVisualID, final boolean forceTransparentFlag) { final long eglDisplay = device.getHandle(); final GLProfile glp = capsChosen.getGLProfile(); final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen); List availableCaps = null; int recommendedIndex = -1; long recommendedEGLConfig = -1; - IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); + final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) { throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: Get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -353,7 +353,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen); - PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); + final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); // 1st choice: get GLCapabilities based on users GLCapabilities // setting recommendedIndex as preferred choice @@ -428,7 +428,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) { // implies !hasEGLChosenCaps - List removedCaps = new ArrayList(); + final List removedCaps = new ArrayList(); for(int i=0; i eglConfigs2GLCaps(EGLGraphicsDevice device, GLProfile glp, PointerBuffer configs, int num, int winattrmask, boolean forceTransparentFlag, boolean onlyFirstValid) { + static List eglConfigs2GLCaps(final EGLGraphicsDevice device, final GLProfile glp, final PointerBuffer configs, final int num, final int winattrmask, final boolean forceTransparentFlag, final boolean onlyFirstValid) { final GLRendererQuirks defaultQuirks = GLRendererQuirks.getStickyDeviceQuirks( GLDrawableFactory.getEGLFactory().getDefaultDevice() ); - List bucket = new ArrayList(num); + final List bucket = new ArrayList(num); for(int i=0; i caps, PrintStream out) { + static void printCaps(final String prefix, final List caps, final PrintStream out) { for(int i=0; i this "+surface.getClass().getSimpleName()+" ): "; @@ -84,7 +84,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } } - private final void evalUpstreamSurface(String dbgPrefix, ProxySurface surface) { + private final void evalUpstreamSurface(final String dbgPrefix, final ProxySurface surface) { // // evaluate nature of upstreamSurface, may create EGL instances if required // @@ -195,7 +195,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final void destroy(ProxySurface surface) { + public final void destroy(final ProxySurface surface) { if(EGLDrawableFactory.DEBUG) { System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); } @@ -206,12 +206,12 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final int getSurfaceWidth(ProxySurface s) { + public final int getSurfaceWidth(final ProxySurface s) { return upstreamSurface.getSurfaceWidth(); } @Override - public final int getSurfaceHeight(ProxySurface s) { + public final int getSurfaceHeight(final ProxySurface s) { return upstreamSurface.getSurfaceHeight(); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java index 4a5113b51..89024eed3 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java @@ -13,14 +13,14 @@ import jogamp.nativewindow.WrappedSurface; */ public class EGLWrappedSurface extends WrappedSurface { - public static EGLWrappedSurface get(NativeSurface surface) { + public static EGLWrappedSurface get(final NativeSurface surface) { if(surface instanceof EGLWrappedSurface) { return (EGLWrappedSurface)surface; } return new EGLWrappedSurface(surface); } - public EGLWrappedSurface(NativeSurface surface) { + public EGLWrappedSurface(final NativeSurface surface) { super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); if(EGLDrawableFactory.DEBUG) { System.err.println("EGLWrappedSurface.ctor(): "+this); -- cgit v1.2.3