diff options
author | Sven Gothel <[email protected]> | 2014-06-09 03:58:37 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-09 03:58:37 +0200 |
commit | 4686a652d821efe04045333026be79270bc19bfd (patch) | |
tree | 240ac4df0ae58c7461e7bfdfb3b438917041a3af /src/newt/native | |
parent | 14ff638b63fc7adaa59f351891f6a38806d7fa5d (diff) |
Bug 741 HiDPI: Add ScalableSurface.getNativeSurfaceScale(..) to compute surface DPI ; Add NEWT Window.getPixelsPerMM(..) to query surface DPI
With HiDPI and surface scale, we need knowledge of the native surface's pixel-scale
matching the monitor's pixel-per-millimeter value.
Preserving the queried native pixel-scale and exposing it via
ScalableSurface.getNativeSurfaceScale(..) to compute surface DPI.
Add NEWT Window.getPixelsPerMM(..) to query surface DPI.
Surface DPI is demonstrated in GraphUI's GPUUISceneGLListener0A .. and TestRulerNEWT01, etc ..
Diffstat (limited to 'src/newt/native')
-rw-r--r-- | src/newt/native/NewtMacWindow.m | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m index fe761833d..5a1963155 100644 --- a/src/newt/native/NewtMacWindow.m +++ b/src/newt/native/NewtMacWindow.m @@ -780,9 +780,9 @@ static jmethodID windowRepaintID = NULL; // HiDPI scaling BOOL useHiDPI = [self wantsBestResolutionOpenGLSurface]; - CGFloat pixelScaleRaw = [[self window] backingScaleFactor]; - CGFloat pixelScaleUse = useHiDPI ? pixelScaleRaw : 1.0; - DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, raw %f -> use %f\n", useHiDPI, (float)pixelScaleRaw, (float)pixelScaleUse); + CGFloat pixelScaleNative = [[self window] backingScaleFactor]; + CGFloat pixelScaleUse = useHiDPI ? pixelScaleNative : 1.0; + DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, native %f -> use %f\n", useHiDPI, (float)pixelScaleNative, (float)pixelScaleUse); [[self layer] setContentsScale: pixelScaleUse]; if (javaWindowObject == NULL) { @@ -796,7 +796,7 @@ static jmethodID windowRepaintID = NULL; return; } - (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)pixelScaleUse); // defer + (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)pixelScaleUse, (jfloat)pixelScaleNative); // defer // detaching thread not required - daemon // NewtCommon_ReleaseJNIEnv(shallBeDetached); @@ -812,7 +812,7 @@ static jmethodID windowRepaintID = NULL; enqueueMouseEventID = (*env)->GetMethodID(env, clazz, "enqueueMouseEvent", "(ZSIIISF)V"); enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZSISCC)V"); sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(ZIIZ)V"); - updatePixelScaleID = (*env)->GetMethodID(env, clazz, "updatePixelScale", "(ZF)V"); + updatePixelScaleID = (*env)->GetMethodID(env, clazz, "updatePixelScale", "(ZFF)V"); visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(ZZ)V"); insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(ZIIII)V"); positionChangedID = (*env)->GetMethodID(env, clazz, "screenPositionChanged", "(ZII)V"); |