src/macosx/classes/com/apple/laf/AquaIcon.java

Print this page

        

*** 192,201 **** --- 192,222 ---- static abstract class CachableJRSUIIcon extends CachingScalingIcon implements UIResource { public CachableJRSUIIcon(final int width, final int height) { super(width, height); } + // paint the icon directly from the AquaPainter + public void paintIcon(final Component c, Graphics g, final int x, final int y) { + if (GraphicsEnvironment.isHeadless()) { + return; + } + + g = g.create(); + + if (g instanceof Graphics2D) { + // improves icon rendering quality in Quartz + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + } + + final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIState.getInstance()); + initIconPainter(painter); + + g.setClip(new Rectangle(x, y, getIconWidth(), getIconHeight())); + painter.paint(g, c, x, y, getIconWidth(), getIconHeight()); + g.dispose(); + } + Image createImage() { final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIState.getInstance()); initIconPainter(painter); final BufferedImage img = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB_PRE);