< prev index next >

src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java

Print this page

        

*** 35,51 **** --- 35,57 ---- import java.awt.Rectangle; import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; + import java.awt.geom.Point2D; import java.awt.image.ColorModel; import java.util.ArrayList; import java.util.Vector; import java.awt.peer.WindowPeer; + import java.security.AccessController; import sun.awt.windows.WWindowPeer; + import sun.java2d.SunGraphicsEnvironment; import sun.java2d.opengl.WGLGraphicsConfig; import sun.java2d.windows.WindowsFlags; + import sun.security.action.GetPropertyAction; + import static sun.awt.Win32GraphicsEnvironment.debugScaleX; + import static sun.awt.Win32GraphicsEnvironment.debugScaleY; /** * This is an implementation of a GraphicsDevice object for a single * Win32 screen. *
*** 79,88 **** --- 85,97 ---- // mode private DisplayMode defaultDisplayMode; // activation/deactivation listener for the full-screen window private WindowListener fsWindowListener; + private float scaleX = 1.0f; + private float scaleY = 1.0f; + static { // 4455041 - Even when ddraw is disabled, ddraw.dll is loaded when // pixel format calls are made. This causes problems when a Java app // is run as an NT service. To prevent the loading of ddraw.dll
*** 95,104 **** --- 104,117 ---- } private static native void initIDs(); native void initDevice(int screen); + native void initNativeScale(int screen); + native void setNativeScale(int screen, float scaleX, float scaleY); + native float getNativeScaleX(int screen); + native float getNativeScaleY(int screen); public Win32GraphicsDevice(int screennum) { this.screen = screennum; // we cache the strings because we want toString() and getIDstring // to reflect the original screen number (which may change if the
*** 107,116 **** --- 120,130 ---- // REMIND: may be should use class name? descString = "Win32GraphicsDevice[screen=" + screen; valid = true; initDevice(screennum); + initScaleFactors(); } /** * Returns the type of the graphics device. * @see #TYPE_RASTER_SCREEN
*** 126,135 **** --- 140,171 ---- */ public int getScreen() { return screen; } + public float getDefaultScaleX() { + return scaleX; + } + + public float getDefaultScaleY() { + return scaleY; + } + + private void initScaleFactors() { + if (SunGraphicsEnvironment.isUIScaleEnabled()) { + if (debugScaleX > 0 && debugScaleY > 0) { + scaleX = debugScaleX; + scaleY = debugScaleY; + setNativeScale(screen, scaleX, scaleY); + } else { + initNativeScale(screen); + scaleX = getNativeScaleX(screen); + scaleY = getNativeScaleY(screen); + } + } + } + /** * Returns whether this is a valid devicie. Device can become * invalid as a result of device removal event. */ public boolean isValid() {
*** 484,493 **** --- 520,530 ---- dynamicColorModel = null; defaultConfig = null; configs = null; // pass on to all top-level windows on this display topLevels.notifyListeners(); + initScaleFactors(); } /** * Part of the DisplayChangedListener interface: devices * do not need to react to this event
< prev index next >