aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Burkhardt <[email protected]>2023-03-06 08:46:16 -0500
committerGlenn Burkhardt <[email protected]>2023-03-06 08:46:16 -0500
commite5e7514d649cd7dd28bbb8e04b72338dc09c2c83 (patch)
tree5f1523bd3be3a499c4bc4bdf39e7f015b13a7f43
parent95250b79766f62d9e5a0f1f46f98ea1f5983a77f (diff)
Fix for AWT GLCcanvas DPI scaling. Forum thread https://forum.jogamp.org/DPI-scaling-not-working-td4042206.html
-rw-r--r--src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java8
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java1
2 files changed, 8 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java
index 0d1b272ba..602671f6e 100644
--- a/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java
@@ -662,8 +662,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
_lock.unlock();
}
} };
+
private final boolean setSurfaceScaleImpl(final ScalableSurface ns) {
- if( ns.setSurfaceScale(reqPixelScale) ) {
+ if(DEBUG) {
+ System.err.printf("GLCanvas.setSurfaceScaleImpl reqPixelScale %.2f %.2f, hasPixelScale %.2f %.2f\n",
+ reqPixelScale[0], reqPixelScale[1], hasPixelScale[0], hasPixelScale[1]);
+ }
+
+ if( ns.setSurfaceScale(hasPixelScale) ) {
ns.getCurrentSurfaceScale(hasPixelScale);
return true;
} else {
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index 6df43bd0f..89ca40096 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -392,6 +392,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
public final boolean updatePixelScale(final GraphicsConfiguration gc, final boolean clearFlag) {
if( JAWTUtil.getPixelScale(gc, minPixelScale, maxPixelScale) ) {
hasPixelScaleChanged = true;
+ System.arraycopy(maxPixelScale, 0, hasPixelScale, 0, 2);
if( DEBUG ) {
System.err.println("JAWTWindow.updatePixelScale: updated req["+
reqPixelScale[0]+", "+reqPixelScale[1]+"], min["+