From 3e85aa120149d882f52faf2c7fb053156313c896 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 3 Jan 2014 04:32:44 +0100 Subject: Bug 935: NEWT PointerIcon PNGIcon: Remove return value 'elem_bytesize[]' which is always 4 (RGBA/BGRA) --- src/newt/classes/jogamp/newt/driver/PNGIcon.java | 5 ++--- src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java | 8 ++++---- src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java | 6 +++--- src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java | 4 ++-- src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/newt/classes/jogamp/newt/driver/PNGIcon.java b/src/newt/classes/jogamp/newt/driver/PNGIcon.java index c958f6ec2..ffa62978f 100644 --- a/src/newt/classes/jogamp/newt/driver/PNGIcon.java +++ b/src/newt/classes/jogamp/newt/driver/PNGIcon.java @@ -81,7 +81,6 @@ public class PNGIcon { * @param width * @param height * @param data_size - * @param elem_bytesize * @param resourcesIdx * @return pixels with origin at upper-left corner. * If storing RGBA8888, component R is located on the lowest 8-bit. @@ -93,9 +92,9 @@ public class PNGIcon { * @throws IOException * @throws MalformedURLException */ - public static ByteBuffer singleToRGBAImage(IOUtil.ClassResources resources, int resourceIdx, boolean toBGRA, int[] width, int[] height, int[] data_size, int[] elem_bytesize) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { + public static ByteBuffer singleToRGBAImage(IOUtil.ClassResources resources, int resourceIdx, boolean toBGRA, int[] width, int[] height, int[] data_size) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { if( avail ) { - return jogamp.newt.driver.opengl.JoglUtilPNGIcon.singleToRGBAImage(resources, resourceIdx, toBGRA, width, height, data_size, elem_bytesize); + return jogamp.newt.driver.opengl.JoglUtilPNGIcon.singleToRGBAImage(resources, resourceIdx, toBGRA, width, height, data_size); } throw new UnsupportedOperationException(err0); } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java index b932efde6..f0f0a955a 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java @@ -66,12 +66,12 @@ public class DisplayDriver extends DisplayImpl { throw new NativeWindowException("Failed to initialize jmethodIDs"); } { - final int[] width = { 0 }, height = { 0 }, data_size = { 0 }, elem_bytesize = { 0 }; + final int[] width = { 0 }, height = { 0 }, data_size = { 0 }; Buffer data=null; if( PNGIcon.isAvailable() ) { try { final IOUtil.ClassResources iconRes = NewtFactory.getWindowIcons(); - data = PNGIcon.singleToRGBAImage(iconRes, iconRes.resourceCount()-1, false /* toBGRA */, width, height, data_size, elem_bytesize); + data = PNGIcon.singleToRGBAImage(iconRes, iconRes.resourceCount()-1, false /* toBGRA */, width, height, data_size); } catch (Exception e) { e.printStackTrace(); } @@ -114,11 +114,11 @@ public class DisplayDriver extends DisplayImpl { @Override protected PointerIcon createPointerIconImpl(final IOUtil.ClassResources pngResource, final int hotX, final int hotY) throws MalformedURLException, InterruptedException, IOException { if( PNGIcon.isAvailable() ) { - final int[] width = { 0 }, height = { 0 }, data_size = { 0 }, elem_bytesize = { 0 }; + final int[] width = { 0 }, height = { 0 }, data_size = { 0 }; if( null != pngResource && 0 < pngResource.resourceCount() ) { - final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, true /* toBGRA */, width, height, data_size, elem_bytesize); return new PointerIconImpl( createPointerIcon0(data, width[0], height[0], hotX, hotY), new Dimension(width[0], height[0]), new Point(hotX, hotY)); + final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, true /* toBGRA */, width, height, data_size); } } return null; diff --git a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java index ea9029006..216a0cb20 100644 --- a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java +++ b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java @@ -90,7 +90,7 @@ public class JoglUtilPNGIcon { return buffer; } - public static ByteBuffer singleToRGBAImage(IOUtil.ClassResources resources, int resourceIdx, boolean toBGRA, int[] width, int[] height, int[] data_size, int[] elem_bytesize) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { + public static ByteBuffer singleToRGBAImage(IOUtil.ClassResources resources, int resourceIdx, boolean toBGRA, int[] width, int[] height, int[] data_size) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { width[0] = 0; height[0] = 0; data_size[0] = 0; @@ -100,8 +100,8 @@ public class JoglUtilPNGIcon { height[0] = image.getHeight(); data_size[0] = image.getWidth() * image.getHeight(); - elem_bytesize[0] = 4; // BGRA - final ByteBuffer buffer = Buffers.newDirectByteBuffer( data_size[0] * elem_bytesize[0] ); + final int elem_bytesize = 4; // BGRA + final ByteBuffer buffer = Buffers.newDirectByteBuffer( data_size[0] * elem_bytesize ); final ByteBuffer bb = image.getData(); final int bpp = image.getBytesPerPixel(); diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java index 72a93ce2e..39b2efd15 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java @@ -106,11 +106,11 @@ public class DisplayDriver extends DisplayImpl { @Override protected PointerIcon createPointerIconImpl(final IOUtil.ClassResources pngResource, final int hotX, final int hotY) throws MalformedURLException, InterruptedException, IOException { if( PNGIcon.isAvailable() ) { - final int[] width = { 0 }, height = { 0 }, data_size = { 0 }, elem_bytesize = { 0 }; + final int[] width = { 0 }, height = { 0 }, data_size = { 0 }; if( null != pngResource && 0 < pngResource.resourceCount() ) { - final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, true /* toBGRA */, width, height, data_size, elem_bytesize); return new PointerIconImpl( createBGRA8888Icon0(data, width[0], height[0], true, hotX, hotY), new Dimension(width[0], height[0]), new Point(hotX, hotY)); + final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, true /* toBGRA */, width, height, data_size); } } return null; diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java index 85b31a77c..c377e7f85 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java @@ -133,9 +133,9 @@ public class DisplayDriver extends DisplayImpl { @Override protected PointerIcon createPointerIconImpl(final IOUtil.ClassResources pngResource, final int hotX, final int hotY) throws MalformedURLException, InterruptedException, IOException { if( PNGIcon.isAvailable() ) { - final int[] width = { 0 }, height = { 0 }, data_size = { 0 }, elem_bytesize = { 0 }; + final int[] width = { 0 }, height = { 0 }, data_size = { 0 }; if( null != pngResource && 0 < pngResource.resourceCount() ) { - final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, false /* toBGRA */, width, height, data_size, elem_bytesize); + final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, false /* toBGRA */, width, height, data_size); final long handle = runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() { @Override public Long run(long dpy) { -- cgit v1.2.3