Print this page
Added gradle and cmake project

Split Close
Expand all
Collapse all
          --- old/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java
          +++ new/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java
↓ open down ↓ 28 lines elided ↑ open up ↑
  29   29  import java.awt.DisplayMode;
  30   30  import java.awt.GraphicsConfiguration;
  31   31  import java.awt.GraphicsDevice;
  32   32  import java.awt.Insets;
  33   33  import java.awt.Rectangle;
  34   34  import java.awt.Window;
  35   35  import java.awt.geom.Rectangle2D;
  36   36  import java.util.Objects;
  37   37  
  38   38  import sun.java2d.SunGraphicsEnvironment;
       39 +import sun.java2d.macos.MacOSFlags;
       40 +import sun.java2d.metal.MTLGraphicsConfig;
  39   41  import sun.java2d.opengl.CGLGraphicsConfig;
  40   42  
  41   43  public final class CGraphicsDevice extends GraphicsDevice
  42   44          implements DisplayChangedListener {
  43   45  
  44   46      /**
  45   47       * CoreGraphics display ID. This identifier can become non-valid at any time
  46   48       * therefore methods, which is using this id should be ready to it.
  47   49       */
  48   50      private volatile int displayID;
↓ open down ↓ 9 lines elided ↑ open up ↑
  58   60      private final int DEFAULT_CONFIG = 0;
  59   61  
  60   62      private static AWTPermission fullScreenExclusivePermission;
  61   63  
  62   64      // Save/restore DisplayMode for the Full Screen mode
  63   65      private DisplayMode originalMode;
  64   66  
  65   67      public CGraphicsDevice(final int displayID) {
  66   68          this.displayID = displayID;
  67   69          configs = new GraphicsConfiguration[] {
  68      -            CGLGraphicsConfig.getConfig(this, displayID, 0)
       70 +                MacOSFlags.isMetalEnabled() ?
       71 +                        MTLGraphicsConfig.getConfig(this, displayID, 0) :
       72 +                        CGLGraphicsConfig.getConfig(this, displayID, 0)
  69   73          };
  70   74      }
  71   75  
  72   76      /**
  73   77       * Return a list of all configurations.
  74   78       */
  75   79      @Override
  76   80      public GraphicsConfiguration[] getConfigurations() {
  77   81          return configs.clone();
  78   82      }
↓ open down ↓ 187 lines elided ↑ open up ↑
 266  270      private static native DisplayMode nativeGetDisplayMode(int displayID);
 267  271  
 268  272      private static native DisplayMode[] nativeGetDisplayModes(int displayID);
 269  273  
 270  274      private static native double nativeGetXResolution(int displayID);
 271  275  
 272  276      private static native double nativeGetYResolution(int displayID);
 273  277  
 274  278      private static native Insets nativeGetScreenInsets(int displayID);
 275  279  
      280 +    private static native String nativeGetMetalDeviceName(int displayID);
      281 +
 276  282      private static native Rectangle2D nativeGetBounds(int displayID);
 277  283  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX