MacOSX: Fix bugs in MacOSXDisplay.setIcon
This commit is contained in:
parent
706a263c75
commit
965b0e1ec4
|
@ -534,9 +534,9 @@ final class MacOSXDisplay implements DisplayImplementation {
|
||||||
int biggest = -1;
|
int biggest = -1;
|
||||||
|
|
||||||
for (int i=0;i<icons.length;i++) {
|
for (int i=0;i<icons.length;i++) {
|
||||||
if (icons[i].limit() > size) {
|
if (icons[i].remaining() > size) {
|
||||||
biggest = i;
|
biggest = i;
|
||||||
size = icons[i].limit();
|
size = icons[i].remaining();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,9 +547,10 @@ final class MacOSXDisplay implements DisplayImplementation {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
width = height = (int) Math.sqrt(size);
|
IntBuffer biggest_icon = icons[biggest].asIntBuffer();
|
||||||
int[] imageData = new int[icons[biggest].remaining()];
|
int[] imageData = new int[biggest_icon.remaining()];
|
||||||
icons[biggest].asIntBuffer().get(imageData);
|
width = height = (int) Math.sqrt(imageData.length);
|
||||||
|
biggest_icon.get(imageData);
|
||||||
|
|
||||||
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||||
img.setRGB(0, 0, width, height, imageData, 0, width);
|
img.setRGB(0, 0, width, height, imageData, 0, width);
|
||||||
|
|
Loading…
Reference in New Issue