< prev index next >
src/java.desktop/macosx/classes/sun/java2d/MacosxSurfaceManagerFactory.java
Print this page
@@ -25,13 +25,13 @@
package sun.java2d;
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
* platform-specific instance of a particular SurfaceManager. Each platform
* (Windows, Unix, etc.) has its own specialized SurfaceManagerFactory.
@@ -49,25 +49,9 @@
* under which the SunVolatileImage was created.
*/
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);
}
}
< prev index next >