summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-20 20:58:40 +0200
committerSven Gothel <[email protected]>2014-05-20 20:58:40 +0200
commit83be0fa0ffe96c1acbc232965c2c03f40768184d (patch)
tree73d93f24921c181a416ffecd8fd8e144b272fd96 /src/nativewindow/classes/com
parent0959f73ed6740724736c4871a7b63e3449f2f185 (diff)
Bug 742 HiDPI: Add access to private HiDPI in AWT pixelScale value in JAWTUtil and JAWTWindow
Diffstat (limited to 'src/nativewindow/classes/com')
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index e2a4ad4bd..8d7c382ee 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -46,6 +46,7 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
+import java.awt.GraphicsDevice;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
@@ -750,6 +751,25 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
return component.hasFocus();
}
+ /**
+ * Returns the pixel scale factor of this {@link Component}'s {@link GraphicsDevice}, if supported.
+ * <p>
+ * If the component is not yet {@link Component#isDisplayable() displayable},
+ * <code>zero</code> is returned.
+ * </p>
+ * <p>
+ * If the component does not support pixel scaling the default
+ * <code>one</code> is returned.
+ * </p>
+ * <p>
+ * Note: Currently only supported on OSX since 1.7.0_40 for HiDPI retina displays
+ * </p>
+ * @return the pixel scale factor
+ */
+ protected final int getPixelScale() {
+ return JAWTUtil.getPixelScale(component);
+ }
+
protected StringBuilder jawt2String(StringBuilder sb) {
if( null == sb ) {
sb = new StringBuilder();
@@ -760,7 +780,9 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
if(null != jawt) {
sb.append("JAWT version: ").append(toHexString(jawt.getCachedVersion())).
append(", CA_LAYER: ").append(JAWTUtil.isJAWTUsingOffscreenLayer(jawt)).
- append(", isLayeredSurface ").append(isOffscreenLayerSurfaceEnabled()).append(", bounds ").append(bounds).append(", insets ").append(insets);
+ append(", isLayeredSurface ").append(isOffscreenLayerSurfaceEnabled()).
+ append(", bounds ").append(bounds).append(", insets ").append(insets).
+ append(", pixelScale ").append(getPixelScale());
} else {
sb.append("JAWT n/a, bounds ").append(bounds).append(", insets ").append(insets);
}