Print this page
rev 54883 : JDK-8220154 Improve java2d rendering performance on macOS by using Metal framework

Split Close
Expand all
Collapse all
          --- old/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
          +++ new/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
↓ open down ↓ 101 lines elided ↑ open up ↑
 102  102  import com.apple.laf.AquaMenuBarUI;
 103  103  import sun.awt.AWTAccessor;
 104  104  import sun.awt.AppContext;
 105  105  import sun.awt.CGraphicsConfig;
 106  106  import sun.awt.CGraphicsDevice;
 107  107  import sun.awt.LightweightFrame;
 108  108  import sun.awt.PlatformGraphicsInfo;
 109  109  import sun.awt.SunToolkit;
 110  110  import sun.awt.datatransfer.DataTransferer;
 111  111  import sun.awt.util.ThreadGroupUtils;
      112 +import sun.java2d.macos.MacOSFlags;
      113 +import sun.java2d.metal.MTLRenderQueue;
 112  114  import sun.java2d.opengl.OGLRenderQueue;
 113  115  import sun.lwawt.LWComponentPeer;
 114  116  import sun.lwawt.LWCursorManager;
 115  117  import sun.lwawt.LWToolkit;
 116  118  import sun.lwawt.LWWindowPeer;
 117  119  import sun.lwawt.LWWindowPeer.PeerType;
 118  120  import sun.lwawt.PlatformComponent;
 119  121  import sun.lwawt.PlatformDropTarget;
 120  122  import sun.lwawt.PlatformWindow;
 121  123  import sun.lwawt.SecurityWarningWindow;
↓ open down ↓ 356 lines elided ↑ open up ↑
 478  480      }
 479  481  
 480  482      @Override
 481  483      public Insets getScreenInsets(final GraphicsConfiguration gc) {
 482  484          return ((CGraphicsConfig) gc).getDevice().getScreenInsets();
 483  485      }
 484  486  
 485  487      @Override
 486  488      public void sync() {
 487  489          // flush the OGL pipeline (this is a no-op if OGL is not enabled)
 488      -        OGLRenderQueue.sync();
      490 +        if (MacOSFlags.isMetalEnabled()) {
      491 +            MTLRenderQueue.sync();
      492 +        } else {
      493 +            OGLRenderQueue.sync();
      494 +        }
 489  495          // setNeedsDisplay() selector was sent to the appropriate CALayer so now
 490  496          // we have to flush the native selectors queue.
 491  497          flushNativeSelectors();
 492  498      }
 493  499  
 494  500      @Override
 495  501      public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
 496  502          return new CRobot(target, (CGraphicsDevice)screen);
 497  503      }
 498  504  
↓ open down ↓ 509 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX