Changeset 17782 in josm for trunk/src/org


Ignore:
Timestamp:
2021-04-14T20:44:16+02:00 (4 years ago)
Author:
simon04
Message:

fix #20035 - Geotagged images are pixelated on retina displays (patch by *Martin*, modified)

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r17740 r17782  
    3939import org.openstreetmap.josm.tools.Destroyable;
    4040import org.openstreetmap.josm.tools.ExifReader;
     41import org.openstreetmap.josm.tools.HiDPISupport;
    4142import org.openstreetmap.josm.tools.ImageProcessor;
    4243import org.openstreetmap.josm.tools.ImageProvider;
     
    819820                    if (bi != null) {
    820821                        r.x = r.y = 0;
    821 
     822                        double hiDPIScale = HiDPISupport.getHiDPIScale();
     823                        int width = (int) (target.width * hiDPIScale);
     824                        int height = (int) (target.height * hiDPIScale);
    822825                        // See https://community.oracle.com/docs/DOC-983611 - The Perils of Image.getScaledInstance()
    823826                        // Pre-scale image when downscaling by more than two times to avoid aliasing from default algorithm
    824                         bi = ImageProvider.createScaledImage(bi, target.width, target.height,
    825                                 RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    826                         r.width = target.width;
    827                         r.height = target.height;
     827                        bi = ImageProvider.createScaledImage(bi, width, height, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
     828                        r.width = width;
     829                        r.height = height;
    828830                        image = bi;
    829831                    }
  • trunk/src/org/openstreetmap/josm/tools/HiDPISupport.java

    r16980 r17782  
    176176     * @return the GUI scale for HiDPI mode, a value of 1.0 means standard mode.
    177177     */
    178     static double getHiDPIScale() {
     178    public static double getHiDPIScale() {
    179179        if (GraphicsEnvironment.isHeadless())
    180180            return 1.0;
Note: See TracChangeset for help on using the changeset viewer.