--- old/src/java.desktop/macosx/classes/sun/java2d/MacosxSurfaceManagerFactory.java 2019-06-19 14:01:51.000000000 +0530 +++ new/src/java.desktop/macosx/classes/sun/java2d/MacosxSurfaceManagerFactory.java 2019-06-19 14:01:51.000000000 +0530 @@ -27,9 +27,9 @@ import sun.awt.image.SunVolatileImage; import sun.awt.image.VolatileSurfaceManager; +import sun.java2d.macos.MacOSFlags; +import sun.java2d.metal.MTLVolatileSurfaceManager; import sun.java2d.opengl.CGLVolatileSurfaceManager; -import sun.java2d.metal.MetalVolatileSurfaceManager; - /** * This is a factory class with static methods for creating a @@ -51,23 +51,7 @@ public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg, Object context) { - if (isMetalSystemProperty()) { - return new MetalVolatileSurfaceManager(vImg, context); - } else { - return new CGLVolatileSurfaceManager(vImg, context); - } - } - - - private boolean isMetalSystemProperty() { - String str = System.getProperty("sun.java2d.metal"); - - if (str != null) { - System.out.println("Property : sun.java2d.metal=" + str); - if (str.equals("true")) { - return true; - } - } - return false; + return MacOSFlags.isMetalEnabled() ? new MTLVolatileSurfaceManager(vImg, context) : + new CGLVolatileSurfaceManager(vImg, context); } }