diff options
author | Sven Gothel <[email protected]> | 2014-05-27 03:55:38 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-05-27 03:55:38 +0200 |
commit | bcda2dad1a6569ffd4eba07b231d50fdafc60b7f (patch) | |
tree | 0482e02420760ab8bceabfd41e18b20db5eab468 /src/newt | |
parent | d149c554b453c86a880a4f0595bb8e340c80d041 (diff) |
Bug 741 HiDPI: Fix regression MIN_MONITOR_DEVICE_PROPERTIES: Adding missing 'Rotated Viewport window-units' / Refine API doc in MonitorModeProps
Regression of commit 56d60b36798fa8dae48bf2aa5e2de6f3178ab0d1
Diffstat (limited to 'src/newt')
9 files changed, 136 insertions, 47 deletions
diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java index 55cbf77f3..74935977c 100644 --- a/src/newt/classes/jogamp/newt/MonitorModeProps.java +++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java @@ -45,34 +45,76 @@ import jogamp.newt.ScreenImpl; * Encodes and decodes {@link MonitorMode} and {@link MonitorDevice} properties. */ public class MonitorModeProps { - /** WARNING: must be synchronized with ScreenMode.h, native implementation - * 2: width, height + /** + * {@value} Elements: width, height + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> */ public static final int NUM_RESOLUTION_PROPERTIES = 2; - /** WARNING: must be synchronized with ScreenMode.h, native implementation - * 1: bpp + /** + * {@value} Element: bpp + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> */ public static final int NUM_SURFACE_SIZE_PROPERTIES = 1; - /** WARNING: must be synchronized with ScreenMode.h, native implementation - * 2: refresh-rate (Hz*100), flags + /** + * {@value} Elements: refresh-rate (Hz*100), flags + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> */ public static final int NUM_SIZEANDRATE_PROPERTIES = 2; - /** WARNING: must be synchronized with ScreenMode.h, native implementation - * 2: id, rotation + /** + * {@value} Elements: id, rotation + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> */ public static final int NUM_MONITOR_MODE_PROPERTIES = 2; - /** WARNING: must be synchronized with ScreenMode.h, native implementation - * count + all the above + /** + * {@value} Elements: + * <ul> + * <li>count</li> + * <li>{@link #NUM_RESOLUTION_PROPERTIES}</li> + * <li>{@link #NUM_SURFACE_SIZE_PROPERTIES}</li> + * <li>{@link #NUM_SIZEANDRATE_PROPERTIES}</li> + * <li>{@link #NUM_MONITOR_MODE_PROPERTIES}</li> + * <li>mode-id</li> + * </ul> + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> */ public static final int NUM_MONITOR_MODE_PROPERTIES_ALL = 8; + /** + * {@value} Elements: count + {@link #NUM_RESOLUTION_PROPERTIES} + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> + */ public static final int IDX_MONITOR_MODE_BPP = 1 // count + MonitorModeProps.NUM_RESOLUTION_PROPERTIES ; + /** + * {@value} Elements: + * <ul> + * <li>count</li> + * <li>{@link #NUM_RESOLUTION_PROPERTIES}</li> + * <li>{@link #NUM_SURFACE_SIZE_PROPERTIES}</li> + * <li>{@link #NUM_SIZEANDRATE_PROPERTIES}</li> + * <li>mode-id</li> + * </ul> + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> + */ public static final int IDX_MONITOR_MODE_ROT = 1 // count + MonitorModeProps.NUM_RESOLUTION_PROPERTIES + MonitorModeProps.NUM_SURFACE_SIZE_PROPERTIES @@ -80,9 +122,24 @@ public class MonitorModeProps { + 1 // id of MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES ; - /** WARNING: must be synchronized with ScreenMode.h, native implementation - * 15: count + id, ScreenSizeMM[width, height], rotated Viewport pixel-units, rotated viewport window-units, currentMonitorModeId, rotation, supportedModeId+ - * Viewport := [x, y, width, height] (4 elements) + /** + * {@value} Elements: + * <ul> + * <li>count</li> + * <li>id</li> + * <li>ScreenSizeMM[width, height] (2 elements)</li> + * <li>Rotated Viewport pixel-units (4 elements)</li> + * <li>Rotated Viewport window-units (4 elements)</li> + * <li>CurrentMonitorModeId</li> + * <li>Rotation</li> + * <li>SupportedModeId+</li> + * </ul> + * <p> + * Viewport := [x, y, width, height] (4 elements) + * </p> + * <p> + * WARNING: must be synchronized with ScreenMode.h, native implementation + * </p> */ public static final int MIN_MONITOR_DEVICE_PROPERTIES = 15; diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 949e7fa3b..a31a1e421 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -489,16 +489,20 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * @return */ private final MonitorDevice getVirtualMonitorDevice(MonitorModeProps.Cache cache, int monitorId, MonitorMode currentMode) { - int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES]; + final int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES]; int i = 0; props[i++] = MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES; props[i++] = monitorId; props[i++] = default_sm_widthmm; props[i++] = default_sm_heightmm; - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = currentMode.getRotatedWidth(); // rotated viewport width - props[i++] = currentMode.getRotatedHeight(); // rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = currentMode.getRotatedWidth(); // rotated viewport width pixel-units + props[i++] = currentMode.getRotatedHeight(); // rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = currentMode.getRotatedWidth(); // rotated viewport width window-units + props[i++] = currentMode.getRotatedHeight(); // rotated viewport height window-units props[i++] = currentMode.getId(); // current mode id props[i++] = currentMode.getRotation(); props[i++] = currentMode.getId(); // supported mode id #1 diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java index 66237204c..a4c70343d 100644 --- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java @@ -105,10 +105,14 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = props.length; props[i++] = 0; // crt_idx i = getScreenSizeMM(outMetrics, props, i); // sizeMM - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = outMetrics.widthPixels; // rotated viewport width - props[i++] = outMetrics.heightPixels; // rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = outMetrics.widthPixels; // rotated viewport width pixel-units + props[i++] = outMetrics.heightPixels; // rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = outMetrics.widthPixels; // rotated viewport width window-units + props[i++] = outMetrics.heightPixels; // rotated viewport height window-units MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); } diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java index a4356707e..128c94e87 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java @@ -105,16 +105,20 @@ public class ScreenDriver extends ScreenImpl { } final MonitorMode currentMode = getModeProps(cache, awtGD.getDisplayMode()); - int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES]; + final int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES]; int i = 0; props[i++] = props.length; props[i++] = 0; // crt_idx props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = currentMode.getRotatedWidth(); // rotated viewport width - props[i++] = currentMode.getRotatedHeight(); // rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = currentMode.getRotatedWidth(); // rotated viewport width pixel-units + props[i++] = currentMode.getRotatedHeight(); // rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = currentMode.getRotatedWidth(); // rotated viewport width window-units + props[i++] = currentMode.getRotatedHeight(); // rotated viewport height window-units MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java index 64bc87a41..efedf7c7a 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java @@ -86,10 +86,14 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = 0; // crt_idx props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = fixedWidth; // FIXME rotated viewport width - props[i++] = fixedHeight; // FIXME rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = fixedWidth; // FIXME rotated viewport width pixel-units + props[i++] = fixedHeight; // FIXME rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = fixedWidth; // FIXME rotated viewport width window-units + props[i++] = fixedHeight; // FIXME rotated viewport height window-units MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java index e0228c10f..404f03eed 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java @@ -79,10 +79,14 @@ public class ScreenDriver extends ScreenImpl { props[i++] = 0; // crt_idx props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = cachedWidth; // rotated viewport width - props[i++] = cachedWidth; // rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = cachedWidth; // rotated viewport width pixel-units + props[i++] = cachedWidth; // rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = cachedWidth; // rotated viewport width window-units + props[i++] = cachedWidth; // rotated viewport height window-units MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); } diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java index 20c60565a..89d7540da 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java @@ -88,10 +88,14 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = 0; // crt_idx props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = cachedWidth; // rotated viewport width - props[i++] = cachedWidth; // rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = cachedWidth; // rotated viewport width pixel-units + props[i++] = cachedWidth; // rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = cachedWidth; // rotated viewport width window-units + props[i++] = cachedWidth; // rotated viewport height window-units MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); } diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java index 541576250..6245f3207 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java @@ -84,10 +84,14 @@ public class ScreenDriver extends ScreenImpl { props[i++] = 0; // crt_idx props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = cachedWidth; // rotated viewport width - props[i++] = cachedWidth; // rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = cachedWidth; // rotated viewport width pixel-units + props[i++] = cachedWidth; // rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = cachedWidth; // rotated viewport width window-units + props[i++] = cachedWidth; // rotated viewport height window-units MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java index 6c22a3fc6..23fd0f80f 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java @@ -187,10 +187,14 @@ class RandR11 implements RandR { props[i++] = crt_idx; props[i++] = widthMM; props[i++] = heightMM; - props[i++] = 0; // rotated viewport x - props[i++] = 0; // rotated viewport y - props[i++] = currentMode.getRotatedWidth(); // rotated viewport width - props[i++] = currentMode.getRotatedHeight(); // rotated viewport height + props[i++] = 0; // rotated viewport x pixel-units + props[i++] = 0; // rotated viewport y pixel-units + props[i++] = currentMode.getRotatedWidth(); // rotated viewport width pixel-units + props[i++] = currentMode.getRotatedHeight(); // rotated viewport height pixel-units + props[i++] = 0; // rotated viewport x window-units + props[i++] = 0; // rotated viewport y window-units + props[i++] = currentMode.getRotatedWidth(); // rotated viewport width window-units + props[i++] = currentMode.getRotatedHeight(); // rotated viewport height window-units props[i++] = currentMode.getId(); // current mode id props[i++] = currentMode.getRotation(); for(int j=0; j<allModesCount; j++) { |