From 731c473740e3e7ccd26ecda7ea0200382795c3a6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 3 Oct 2015 05:07:46 +0200 Subject: Bug 1237: Adopt GlueGen's clarification of IOUtil.getResource(..), commit d78bb1be0a6290cb94918b21865a023c01825048 - Skip relative lookup for IOUtil.ClassResources using 'asset' only (from JAR file) - Tested w/ jar file and build-dir, see scripts/tests.sh 'USE_BUILDDIR' --- src/newt/classes/com/jogamp/newt/NewtFactory.java | 6 +++--- .../classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java | 10 +++++----- .../classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 2ed2194d8..f7b5a1340 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -59,6 +59,7 @@ public class NewtFactory { public static final String DRIVER_DEFAULT_ROOT_PACKAGE = "jogamp.newt.driver"; private static IOUtil.ClassResources defaultWindowIcons; + private static String sysPaths = "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png"; static { AccessController.doPrivileged(new PrivilegedAction() { @@ -67,12 +68,11 @@ public class NewtFactory { NativeWindowFactory.initSingleton(); // last resort .. { /** See API Doc in {@link Window} ! */ - final String[] paths = PropertyAccess.getProperty("newt.window.icons", true, "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png").split("\\s"); + final String[] paths = PropertyAccess.getProperty("newt.window.icons", true, sysPaths).split("\\s"); if( paths.length < 2 ) { throw new IllegalArgumentException("Property 'newt.window.icons' did not specify at least two PNG icons, but "+Arrays.toString(paths)); } - final Class clazz = NewtFactory.class; - defaultWindowIcons = new IOUtil.ClassResources(clazz, paths); + defaultWindowIcons = new IOUtil.ClassResources(paths, NewtFactory.class.getClassLoader(), null); } return null; } } ); diff --git a/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java b/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java index d49ddab42..84c4683db 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java +++ b/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java @@ -440,7 +440,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous disp.createNative(); { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "newt/data/cross-grey-alpha-16x16.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/cross-grey-alpha-16x16.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 8, 8); pointerIcons.add(_pointerIcon); @@ -451,7 +451,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "newt/data/pointer-grey-alpha-16x24.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/pointer-grey-alpha-16x24.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); pointerIcons.add(_pointerIcon); @@ -462,7 +462,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "arrow-red-alpha-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-red-alpha-64x64.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); pointerIcons.add(_pointerIcon); @@ -473,7 +473,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "arrow-blue-alpha-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-blue-alpha-64x64.png" }, disp.getClass().getClassLoader(), null); try { _pointerIcon = disp.createPointerIcon(res, 0, 0); pointerIcons.add(_pointerIcon); @@ -484,7 +484,7 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous } if( PNGIcon.isAvailable() ) { PointerIcon _pointerIcon = null; - final IOUtil.ClassResources res = new IOUtil.ClassResources(disp.getClass(), new String[] { "jogamp-pointer-64x64.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "jogamp-pointer-64x64.png" }, disp.getClass().getClassLoader(), null); try { final URLConnection urlConn = res.resolve(0); if( null != urlConn ) { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java index d111e850e..715d32ceb 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java @@ -67,7 +67,7 @@ public class DisplayDriver extends DisplayImpl { PNGPixelRect image = null; if( DisplayImpl.isPNGUtilAvailable() ) { - final IOUtil.ClassResources res = new IOUtil.ClassResources(DisplayDriver.class, new String[] { "newt/data/pointer-grey-alpha-16x24.png" } ); + final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/pointer-grey-alpha-16x24.png" }, DisplayDriver.class.getClassLoader(), null); try { final URLConnection urlConn = res.resolve(0); image = PNGPixelRect.read(urlConn.getInputStream(), PixelFormat.BGRA8888, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); -- cgit v1.2.3