aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-16 06:23:43 +0100
committerSven Gothel <[email protected]>2015-02-16 06:23:43 +0100
commit70faf070f50ea66fd4cc8f5f586614810f378787 (patch)
treec4e1175587337386620c823927c017c6fd68c727 /src/test/com/jogamp
parent1eea4278f1be5900f0d990d0a7d352923def217c (diff)
Bug 1129 - NEWT MonitorDevice's physical size on Windows must be read via EDID
On Windows, one must read the monitor's EDID data as stored in the registry, no 'simple' API works otherwise. The proper way requires utilizing the Windows Setup-API. This code is inspired by Ofek Shilon's code and blog post: <http://ofekshilon.com/2014/06/19/reading-specific-monitor-dimensions/> See: function 'NewtEDID_GetMonitorSizeFromEDIDByModelName' In contrast to Ofek's code, function 'NewtEDID_GetMonitorSizeFromEDIDByDevice' uses the proper link from DISPLAY_DEVICE.DeviceID -> SP_DEVICE_INTERFACE_DETAIL_DATA.DevicePath, where DISPLAY_DEVICE.DeviceID is the monitor's enumeration via: EnumDisplayDevices(adapterName, monitor_idx, &ddMon, EDD_GET_DEVICE_INTERFACE_NAME); Hence the path to the registry-entry is well determined instead of just comparing the monitor's model name.
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java
index be15e3b7e..e103fc490 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java
@@ -173,6 +173,9 @@ public class TestScreenMode00aNEWT extends UITestCase {
for(final Iterator<MonitorDevice> iMonitor=monitors.iterator(); iMonitor.hasNext(); j++) {
final MonitorDevice monitor = iMonitor.next();
System.err.println(j+": "+monitor);
+ final float[] pixelPerMM = monitor.getPixelsPerMM(new float[2]);
+ System.err.println(j+" pp/mm ["+pixelPerMM[0]+", "+pixelPerMM[1]+"]");
+ System.err.println(j+" pp/in ["+pixelPerMM[0]*25.4f+", "+pixelPerMM[1]*25.4f+"]");
final List<MonitorMode> modes = monitor.getSupportedModes();
Assert.assertTrue(modes.size()>0);
int i=0;
@@ -195,21 +198,21 @@ public class TestScreenMode00aNEWT extends UITestCase {
Assert.assertNotNull(sm_c);
Assert.assertEquals(sm_o, sm_c);
}
-
+
final RectangleImmutable zero = new Rectangle();
-
+
final Rectangle monitorViewPU = new Rectangle();
final Rectangle monitorViewWU = new Rectangle();
MonitorDevice.unionOfViewports(monitorViewPU, monitorViewWU, monitors);
- System.err.println("Test.0: Monitor union viewport: "+monitorViewPU+" [pu] / "+monitorViewWU+" [wu]");
+ System.err.println("Test.0: Monitor union viewport: "+monitorViewPU+" [pu] / "+monitorViewWU+" [wu]");
Assert.assertNotEquals(zero, monitorViewPU);
- Assert.assertNotEquals(zero, monitorViewWU);
-
+ Assert.assertNotEquals(zero, monitorViewWU);
+
final RectangleImmutable screenViewPU = screen.getViewport();
- final RectangleImmutable screenViewWU = screen.getViewportInWindowUnits();
- System.err.println("Test.1: Screen viewport: "+screenViewPU+" [pu] / "+screenViewWU+" [wu]");
+ final RectangleImmutable screenViewWU = screen.getViewportInWindowUnits();
+ System.err.println("Test.1: Screen viewport: "+screenViewPU+" [pu] / "+screenViewWU+" [wu]");
Assert.assertNotEquals(zero, screenViewPU);
- Assert.assertNotEquals(zero, screenViewWU);
+ Assert.assertNotEquals(zero, screenViewWU);
screen.removeReference();