src/macosx/classes/sun/lwawt/macosx/CImage.java

Print this page

        

*** 222,249 **** Dimension2D[] sizes = nativeGetNSImageRepresentationSizes(ptr, size.getWidth(), size.getHeight()); ! if (sizes == null || sizes.length < 2) { ! return toImage(w, h, w, h); ! } ! ! BufferedImage[] images = new BufferedImage[sizes.length]; ! int currentImageIndex = 0; ! ! for (int i = 0; i < sizes.length; i++) { ! int imageRepWidth = (int) sizes[i].getWidth(); ! int imageRepHeight = (int) sizes[i].getHeight(); ! if(imageRepHeight <= w && imageRepHeight <= h){ ! currentImageIndex = i; ! } ! images[i] = toImage(w, h, imageRepWidth, imageRepHeight); ! } ! return new MultiResolutionBufferedImage(BufferedImage.TYPE_INT_ARGB_PRE, ! currentImageIndex, images); } private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) { final BufferedImage bimg = new BufferedImage(dstWidth, dstHeight, BufferedImage.TYPE_INT_ARGB_PRE); final DataBufferInt dbi = (DataBufferInt)bimg.getRaster().getDataBuffer(); --- 222,236 ---- Dimension2D[] sizes = nativeGetNSImageRepresentationSizes(ptr, size.getWidth(), size.getHeight()); ! BufferedImage baseImage = toImage(w, h, w, h); ! return sizes == null || sizes.length < 2 ? baseImage ! : new MultiResolutionBufferedImage(baseImage, sizes, ! (width, height) -> toImage(w, h, width, height)); } private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) { final BufferedImage bimg = new BufferedImage(dstWidth, dstHeight, BufferedImage.TYPE_INT_ARGB_PRE); final DataBufferInt dbi = (DataBufferInt)bimg.getRaster().getDataBuffer();