src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java

Print this page

        

*** 24,48 **** */ package sun.awt.image; import java.awt.Image; import java.awt.image.ImageObserver; import java.util.Arrays; import java.util.List; import sun.misc.SoftCache; ! public class MultiResolutionToolkitImage extends ToolkitImage implements MultiResolutionImage { ! Image resolutionVariant; ! public MultiResolutionToolkitImage(Image lowResolutionImage, Image resolutionVariant) { super(lowResolutionImage.getSource()); this.resolutionVariant = resolutionVariant; } @Override ! public Image getResolutionVariant(int width, int height) { return ((width <= getWidth() && height <= getHeight())) ? this : resolutionVariant; } public Image getResolutionVariant() { --- 24,68 ---- */ package sun.awt.image; import java.awt.Image; import java.awt.image.ImageObserver; + import java.awt.image.MultiResolutionImage; import java.util.Arrays; import java.util.List; import sun.misc.SoftCache; ! public class MultiResolutionToolkitImage extends ToolkitImage ! implements MultiResolutionImage { ! private final Image resolutionVariant; ! private final ImageResolutionHelper imageResolutionHelper; ! public MultiResolutionToolkitImage(Image lowResolutionImage, ! Image resolutionVariant) { ! this(lowResolutionImage, resolutionVariant, ! ImageResolutionHelperType.getPlatformHelper()); ! } ! ! public MultiResolutionToolkitImage(Image lowResolutionImage, ! Image resolutionVariant, ImageResolutionHelper imageResolutionHelper) { super(lowResolutionImage.getSource()); this.resolutionVariant = resolutionVariant; + this.imageResolutionHelper = imageResolutionHelper; } @Override ! public Image getResolutionVariant(float logicalDPIX, float logicalDPIY, ! float baseWidth, float baseHeight, float destWidth, float destHeight) { ! float hiDPIWidth = imageResolutionHelper.getHiDPISize(logicalDPIX, ! baseWidth, destWidth); ! float hiDPIHeight = imageResolutionHelper.getHiDPISize(logicalDPIY, ! baseHeight, destHeight); ! return getResolutionVariant(hiDPIWidth, hiDPIHeight); ! } ! ! private Image getResolutionVariant(float width, float height) { return ((width <= getWidth() && height <= getHeight())) ? this : resolutionVariant; } public Image getResolutionVariant() {