--- old/src/macosx/classes/com/apple/laf/AquaImageFactory.java 2014-03-12 18:52:32.000000000 +0400 +++ new/src/macosx/classes/com/apple/laf/AquaImageFactory.java 2014-03-12 18:52:32.000000000 +0400 @@ -125,16 +125,14 @@ private static final int kAlertIconSize = 64; static IconUIResource getAppIconCompositedOn(final Image background) { - final BufferedImage iconImage = getAppIconImageCompositedOn(background, 1); - - if (background instanceof MultiResolutionIconImage) { - BufferedImage background2x - = ((MultiResolutionIconImage) background).resolutionVariant; - BufferedImage icon2xImage = getAppIconImageCompositedOn(background2x, 2); - - return new IconUIResource(new ImageIcon( - new MultiResolutionIconImage(iconImage, icon2xImage))); + if (background instanceof MultiResolutionBufferedImage) { + int width = background.getWidth(null); + Image mrIconImage = ((MultiResolutionBufferedImage) background).map( + rv -> getAppIconImageCompositedOn(rv, rv.getWidth(null) / width)); + return new IconUIResource(new ImageIcon(mrIconImage)); } + + BufferedImage iconImage = getAppIconImageCompositedOn(background, 1); return new IconUIResource(new ImageIcon(iconImage)); } @@ -312,10 +310,16 @@ return icon; } - Image icon2x = AquaUtils.getCImageCreator().createImageFromName( - imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null)); - return new MultiResolutionBufferedImage( - BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x); + int w = icon.getWidth(null); + int h = icon.getHeight(null); + + Dimension[] sizes = new Dimension[]{ + new Dimension(w, h), new Dimension(2 * w, 2 * h) + }; + + return new MultiResolutionBufferedImage(icon, sizes, (width, height) -> + AquaUtils.getCImageCreator().createImageFromName( + imageName, width, height)); } public static class NineSliceMetrics { @@ -524,29 +528,4 @@ public static Color getSelectionInactiveForegroundColorUIResource() { return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR)); } - - static class MultiResolutionIconImage extends BufferedImage - implements MultiResolutionImage { - - BufferedImage resolutionVariant; - - public MultiResolutionIconImage(BufferedImage image, BufferedImage resolutionVariant) { - super(image.getWidth(), image.getHeight(), image.getType()); - this.resolutionVariant = resolutionVariant; - Graphics g = getGraphics(); - g.drawImage(image, 0, 0, null); - g.dispose(); - } - - @Override - public Image getResolutionVariant(int width, int height) { - return ((width <= getWidth() && height <= getHeight())) - ? this : resolutionVariant; - } - - @Override - public List getResolutionVariants() { - return Arrays.asList(this, resolutionVariant); - } - } -} +} \ No newline at end of file