diff options
author | Anton Tarasov <anton.tarasov@jetbrains.com> | 2017-09-26 16:52:50 +0300 |
---|---|---|
committer | Anton Tarasov <anton.tarasov@jetbrains.com> | 2017-10-11 13:03:33 +0300 |
commit | b8293559c40d2de3c6e1f3986c09e8d8b01c1c3f (patch) | |
tree | 05aa850a5d69d9794d79165b5eb9b39793fb5d17 /src/macosx | |
parent | a2917a489382ec2e6ed3fe02479b6f3227b0cb7e (diff) | |
download | jdk8u_jdk-b8293559c40d2de3c6e1f3986c09e8d8b01c1c3f.tar.gz |
JRE-310 [backported] JDK-8150844: [hidpi] [macosx] -Dsun.java2d.uiScale should be taken into account for OS X
Diffstat (limited to 'src/macosx')
-rw-r--r-- | src/macosx/classes/sun/awt/CGraphicsDevice.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/macosx/classes/sun/awt/CGraphicsDevice.java b/src/macosx/classes/sun/awt/CGraphicsDevice.java index 29d90a38ba..211eeaaa02 100644 --- a/src/macosx/classes/sun/awt/CGraphicsDevice.java +++ b/src/macosx/classes/sun/awt/CGraphicsDevice.java @@ -32,7 +32,7 @@ import java.awt.GraphicsDevice; import java.awt.Insets; import java.awt.Window; import java.util.Objects; - +import sun.java2d.SunGraphicsEnvironment; import sun.java2d.opengl.CGLGraphicsConfig; public final class CGraphicsDevice extends GraphicsDevice @@ -140,7 +140,7 @@ public final class CGraphicsDevice extends GraphicsDevice public void displayChanged() { xResolution = nativeGetXResolution(displayID); yResolution = nativeGetYResolution(displayID); - scale = (int) nativeGetScaleFactor(displayID); + initScaleFactor(); //TODO configs/fullscreenWindow/modes? } @@ -249,6 +249,17 @@ public final class CGraphicsDevice extends GraphicsDevice return nativeGetDisplayModes(displayID); } + private void initScaleFactor() { + if (SunGraphicsEnvironment.isUIScaleEnabled()) { + double debugScale = SunGraphicsEnvironment.getDebugScale(); + scale = (int) (debugScale >= 1 + ? Math.round(debugScale) + : nativeGetScaleFactor(displayID)); + } else { + scale = 1; + } + } + private static native double nativeGetScaleFactor(int displayID); private static native void nativeSetDisplayMode(int displayID, int w, int h, int bpp, int refrate); |