34 import java.util.ListIterator; 35 36 import sun.awt.windows.WToolkit; 37 import sun.java2d.SunGraphicsEnvironment; 38 import sun.java2d.SurfaceManagerFactory; 39 import sun.java2d.WindowsSurfaceManagerFactory; 40 import sun.java2d.d3d.D3DGraphicsDevice; 41 import sun.java2d.windows.WindowsFlags; 42 43 /** 44 * This is an implementation of a GraphicsEnvironment object for the 45 * default local GraphicsEnvironment used by the Java Runtime Environment 46 * for Windows. 47 * 48 * @see GraphicsDevice 49 * @see GraphicsConfiguration 50 */ 51 52 public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment { 53 54 static { 55 // Ensure awt is loaded already. Also, this forces static init 56 // of WToolkit and Toolkit, which we depend upon 57 WToolkit.loadLibraries(); 58 // setup flags before initializing native layer 59 WindowsFlags.initFlags(); 60 initDisplayWrapper(); 61 62 // Install correct surface manager factory. 63 SurfaceManagerFactory.setInstance(new WindowsSurfaceManagerFactory()); 64 } 65 66 /** 67 * Initializes native components of the graphics environment. This 68 * includes everything from the native GraphicsDevice elements to 69 * the DirectX rendering layer. 70 */ 71 private static native void initDisplay(); 72 73 private static boolean displayInitialized; // = false; 74 public static void initDisplayWrapper() { 75 if (!displayInitialized) { 76 displayInitialized = true; 77 initDisplay(); 78 } 79 } 80 81 public Win32GraphicsEnvironment() { 82 } 83 | 34 import java.util.ListIterator; 35 36 import sun.awt.windows.WToolkit; 37 import sun.java2d.SunGraphicsEnvironment; 38 import sun.java2d.SurfaceManagerFactory; 39 import sun.java2d.WindowsSurfaceManagerFactory; 40 import sun.java2d.d3d.D3DGraphicsDevice; 41 import sun.java2d.windows.WindowsFlags; 42 43 /** 44 * This is an implementation of a GraphicsEnvironment object for the 45 * default local GraphicsEnvironment used by the Java Runtime Environment 46 * for Windows. 47 * 48 * @see GraphicsDevice 49 * @see GraphicsConfiguration 50 */ 51 52 public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment { 53 54 static final float debugScaleX; 55 static final float debugScaleY; 56 57 static { 58 // Ensure awt is loaded already. Also, this forces static init 59 // of WToolkit and Toolkit, which we depend upon 60 WToolkit.loadLibraries(); 61 // setup flags before initializing native layer 62 WindowsFlags.initFlags(); 63 initDisplayWrapper(); 64 65 // Install correct surface manager factory. 66 SurfaceManagerFactory.setInstance(new WindowsSurfaceManagerFactory()); 67 68 double sx = -1; 69 double sy = -1; 70 if (isUIScaleEnabled()) { 71 sx = getScaleFactor("sun.java2d.win.uiScaleX"); 72 sy = getScaleFactor("sun.java2d.win.uiScaleY"); 73 if (sx <= 0 || sy <= 0) { 74 double s = getDebugScale(); 75 sx = s; 76 sy = s; 77 } 78 } 79 80 debugScaleX = (float) sx; 81 debugScaleY = (float) sy; 82 } 83 84 /** 85 * Initializes native components of the graphics environment. This 86 * includes everything from the native GraphicsDevice elements to 87 * the DirectX rendering layer. 88 */ 89 private static native void initDisplay(); 90 91 private static boolean displayInitialized; // = false; 92 public static void initDisplayWrapper() { 93 if (!displayInitialized) { 94 displayInitialized = true; 95 initDisplay(); 96 } 97 } 98 99 public Win32GraphicsEnvironment() { 100 } 101 |