diff --git a/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java b/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
index 9e1075028..c983338fd 100644
|
a
|
b
|
import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
|
| 35 | 35 | import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; |
| 36 | 36 | import org.openstreetmap.josm.tools.Destroyable; |
| 37 | 37 | import org.openstreetmap.josm.tools.ExifReader; |
| | 38 | import org.openstreetmap.josm.tools.HiDPISupport; |
| 38 | 39 | import org.openstreetmap.josm.tools.ImageProvider; |
| 39 | 40 | import org.openstreetmap.josm.tools.Logging; |
| 40 | 41 | |
| … |
… |
public class ImageDisplay extends JComponent implements Destroyable, PreferenceC
|
| 774 | 775 | if (bi != null) { |
| 775 | 776 | r.x = r.y = 0; |
| 776 | 777 | |
| | 778 | double s = HiDPISupport.getHiDPIScale(); |
| | 779 | |
| 777 | 780 | // See https://community.oracle.com/docs/DOC-983611 - The Perils of Image.getScaledInstance() |
| 778 | 781 | // Pre-scale image when downscaling by more than two times to avoid aliasing from default algorithm |
| 779 | | bi = ImageProvider.createScaledImage(bi, target.width, target.height, |
| | 782 | bi = ImageProvider.createScaledImage(bi, (int) (target.width * s), (int) (target.height * s), |
| 780 | 783 | RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
| 781 | | r.width = target.width; |
| 782 | | r.height = target.height; |
| | 784 | r.width = (int) (target.width * s); |
| | 785 | r.height = (int) (target.height * s); |
| | 786 | |
| 783 | 787 | image = bi; |
| 784 | 788 | } |
| 785 | 789 | } catch (OutOfMemoryError oom) { |
diff --git a/src/org/openstreetmap/josm/tools/HiDPISupport.java b/src/org/openstreetmap/josm/tools/HiDPISupport.java
index b84e5879e..e187fd53f 100644
|
a
|
b
|
public final class HiDPISupport {
|
| 175 | 175 | * only take the default screen device into account. |
| 176 | 176 | * @return the GUI scale for HiDPI mode, a value of 1.0 means standard mode. |
| 177 | 177 | */ |
| 178 | | static double getHiDPIScale() { |
| | 178 | public static double getHiDPIScale() { |
| 179 | 179 | if (GraphicsEnvironment.isHeadless()) |
| 180 | 180 | return 1.0; |
| 181 | 181 | GraphicsConfiguration gc = GraphicsEnvironment |