8208996: X11 icon window color handing bug
authorserb
Wed, 08 Aug 2018 18:31:24 -0700
changeset 51904 5ade5b3a227e
parent 51903 f91e995f6d5c
child 51905 cd7d2f9154fd
8208996: X11 icon window color handing bug Reviewed-by: serb Contributed-by: takiguc@linux.vnet.ibm.com
src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java
--- a/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java	Fri Aug 03 12:52:58 2018 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java	Wed Aug 08 18:31:24 2018 -0700
@@ -281,8 +281,9 @@
                 ColorData cdata = adata.get_color_data(0);
                 int num_colors = cdata.get_awt_numICMcolors();
                 for (int i = 0; i < buf.length; i++) {
-                    buf[i] = (buf[i] >= num_colors) ?
-                        0 : cdata.get_awt_icmLUT2Colors(buf[i]);
+                    int b = Byte.toUnsignedInt(buf[i]);
+                    buf[i] = (b >= num_colors) ?
+                        0 : cdata.get_awt_icmLUT2Colors(b);
                 }
                 bytes = Native.toData(buf);
             } else if (srcBuf instanceof DataBufferInt) {