From 1dd93bdfd2f7b0ba3d1db901f3e7aeedb9013d00 Mon Sep 17 00:00:00 2001 From: Nikita Gubarkov Date: Fri, 25 Apr 2025 15:25:06 +0200 Subject: [PATCH 1/5] 8355611: Get rid of SurfaceManagerFactory --- .../classes/sun/awt/CGraphicsEnvironment.java | 4 - .../java2d/MacosxSurfaceManagerFactory.java | 57 ------------ .../sun/java2d/metal/MTLGraphicsConfig.java | 8 +- .../sun/java2d/opengl/CGLGraphicsConfig.java | 6 ++ .../sun/awt/image/SunVolatileImage.java | 31 ++----- .../classes/sun/awt/image/SurfaceManager.java | 15 +++ .../sun/java2d/SurfaceManagerFactory.java | 91 ------------------- .../sun/java2d/opengl/OGLGraphicsConfig.java | 2 +- .../classes/sun/awt/X11GraphicsConfig.java | 9 +- .../sun/awt/X11GraphicsEnvironment.java | 6 -- .../sun/java2d/UnixSurfaceManagerFactory.java | 68 -------------- .../sun/java2d/opengl/GLXGraphicsConfig.java | 6 ++ .../sun/java2d/xr/XRGraphicsConfig.java | 9 +- .../sun/awt/Win32GraphicsEnvironment.java | 5 - .../java2d/WindowsSurfaceManagerFactory.java | 66 -------------- .../sun/java2d/d3d/D3DGraphicsConfig.java | 8 +- .../sun/java2d/opengl/WGLGraphicsConfig.java | 6 ++ 17 files changed, 73 insertions(+), 324 deletions(-) delete mode 100644 src/java.desktop/macosx/classes/sun/java2d/MacosxSurfaceManagerFactory.java delete mode 100644 src/java.desktop/share/classes/sun/java2d/SurfaceManagerFactory.java delete mode 100644 src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java delete mode 100644 src/java.desktop/windows/classes/sun/java2d/WindowsSurfaceManagerFactory.java diff --git a/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java b/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java index fe4431e309128..e11dabc7a10db 100644 --- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java +++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java @@ -37,9 +37,7 @@ import java.util.ListIterator; import java.util.Map; -import sun.java2d.MacosxSurfaceManagerFactory; import sun.java2d.SunGraphicsEnvironment; -import sun.java2d.SurfaceManagerFactory; /** * This is an implementation of a GraphicsEnvironment object for the default @@ -70,8 +68,6 @@ public static void init() { } static { // Load libraries and initialize the Toolkit. Toolkit.getDefaultToolkit(); - // Install the correct surface manager factory. - SurfaceManagerFactory.setInstance(new MacosxSurfaceManagerFactory()); } /** diff --git a/src/java.desktop/macosx/classes/sun/java2d/MacosxSurfaceManagerFactory.java b/src/java.desktop/macosx/classes/sun/java2d/MacosxSurfaceManagerFactory.java deleted file mode 100644 index 93fac3fb22a49..0000000000000 --- a/src/java.desktop/macosx/classes/sun/java2d/MacosxSurfaceManagerFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.java2d; - -import sun.awt.image.SunVolatileImage; -import sun.awt.image.VolatileSurfaceManager; -import sun.awt.CGraphicsDevice; -import sun.java2d.metal.MTLVolatileSurfaceManager; -import sun.java2d.opengl.CGLVolatileSurfaceManager; - -/** - * 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. - */ -public class MacosxSurfaceManagerFactory extends SurfaceManagerFactory { - - /** - * Creates a new instance of a VolatileSurfaceManager given any - * arbitrary SunVolatileImage. An optional context Object can be supplied - * as a way for the caller to pass pipeline-specific context data to - * the VolatileSurfaceManager (such as a backbuffer handle, for example). - * - * For Mac OS X, this method returns either an CGL/MTL-specific - * VolatileSurfaceManager based on the GraphicsConfiguration - * under which the SunVolatileImage was created. - */ - public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg, - Object context) - { - return CGraphicsDevice.usingMetalPipeline() ? new MTLVolatileSurfaceManager(vImg, context) : - new CGLVolatileSurfaceManager(vImg, context); - } -} diff --git a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java index 82adac72c03b5..4d7609d0857d5 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java @@ -29,6 +29,7 @@ import sun.awt.CGraphicsDevice; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; +import sun.awt.image.VolatileSurfaceManager; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; import sun.java2d.Surface; @@ -67,7 +68,7 @@ import static sun.java2d.metal.MTLContext.MTLContextCaps.CAPS_EXT_BIOP_SHADER; public final class MTLGraphicsConfig extends CGraphicsConfig - implements AccelGraphicsConfig + implements AccelGraphicsConfig, SurfaceManager.Factory { private static ImageCapabilities imageCaps = new MTLImageCaps(); @@ -372,4 +373,9 @@ public int getMaxTextureHeight() { return Math.max(maxTextureSize / getDevice().getScaleFactor(), getBounds().height); } + + @Override + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + return new MTLVolatileSurfaceManager(image, context); + } } diff --git a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java index ee9b0aec3a009..380c01a855dc8 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java @@ -46,6 +46,7 @@ import sun.awt.CGraphicsDevice; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; +import sun.awt.image.VolatileSurfaceManager; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; import sun.java2d.Surface; @@ -386,4 +387,9 @@ public int getMaxTextureHeight() { return Math.max(maxTextureSize / getDevice().getScaleFactor(), getBounds().height); } + + @Override + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + return new CGLVolatileSurfaceManager(image, context); + } } diff --git a/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java b/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java index 55dfc8db7662a..0faa11ce58c00 100644 --- a/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java +++ b/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java @@ -37,7 +37,6 @@ import java.awt.image.ImageObserver; import java.awt.image.VolatileImage; import sun.java2d.SunGraphics2D; -import sun.java2d.SurfaceManagerFactory; import sun.java2d.DestSurfaceProvider; import sun.java2d.Surface; import sun.java2d.pipe.Region; @@ -158,29 +157,17 @@ public int getForcedAccelSurfaceType() { return forcedAccelSurfaceType; } - protected VolatileSurfaceManager createSurfaceManager(Object context, - ImageCapabilities caps) - { - /** - * Platform-specific SurfaceManagerFactories will return a - * manager suited to acceleration on each platform. But if - * the user is asking for a VolatileImage from a BufferedImageGC, - * then we need to return the appropriate unaccelerated manager. - * Note: this could change in the future; if some platform would - * like to accelerate BIGC volatile images, then this special-casing - * of the BIGC graphicsConfig should live in platform-specific - * code instead. - * We do the same for a Printer Device, and if user requested an - * unaccelerated VolatileImage by passing the capabilities object. - */ - if (graphicsConfig instanceof BufferedImageGraphicsConfig || - graphicsConfig instanceof sun.print.PrinterGraphicsConfig || - (caps != null && !caps.isAccelerated())) - { + private VolatileSurfaceManager createSurfaceManager(Object context, + ImageCapabilities caps) { + // GraphicsConfig may provide some specific surface manager implementation. + // In case it doesn't, or we were specifically requested to use an unaccelerated + // surface, fall back to the buffered image surface manager. + if ((caps == null || caps.isAccelerated()) && + graphicsConfig instanceof SurfaceManager.Factory factory) { + return factory.createVolatileManager(this, context); + } else { return new BufImgVolatileSurfaceManager(this, context); } - SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance(); - return smf.createVolatileManager(this, context); } private Color getForeground() { diff --git a/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java b/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java index 9f605eed4e398..1fa7579529ca6 100644 --- a/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java +++ b/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java @@ -183,6 +183,21 @@ public boolean isAccelerated() { } } + /** + * An interface for GraphicsConfiguration objects to implement if + * they create their own VolatileSurfaceManager implementations. + */ + public interface Factory { + + /** + * Creates a new instance of a VolatileSurfaceManager given a + * compatible SunVolatileImage. An optional context Object can be supplied + * as a way for the caller to pass pipeline-specific context data to + * the VolatileSurfaceManager (such as a backbuffer handle, for example). + */ + VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context); + } + /** * An interface for GraphicsConfiguration objects to implement if * their surfaces accelerate images using SurfaceDataProxy objects. diff --git a/src/java.desktop/share/classes/sun/java2d/SurfaceManagerFactory.java b/src/java.desktop/share/classes/sun/java2d/SurfaceManagerFactory.java deleted file mode 100644 index 39b6d2e33cf5b..0000000000000 --- a/src/java.desktop/share/classes/sun/java2d/SurfaceManagerFactory.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.java2d; - -import sun.awt.image.SunVolatileImage; -import sun.awt.image.VolatileSurfaceManager; - -/** - * This factory creates platform specific VolatileSurfaceManager - * implementations. - * - * There are two platform specific SurfaceManagerFactories in OpenJDK, - * UnixSurfaceManagerFactory and WindowsSurfaceManagerFactory. - * The actually used SurfaceManagerFactory is set by the respective platform - * GraphicsEnvironment implementations in the static initializer. - */ -public abstract class SurfaceManagerFactory { - - /** - * The single shared instance. - */ - private static SurfaceManagerFactory instance; - - /** - * Returns the surface manager factory instance. This returns a factory - * that has been set by {@link #setInstance(SurfaceManagerFactory)}. - * - * @return the surface manager factory - */ - public static synchronized SurfaceManagerFactory getInstance() { - - if (instance == null) { - throw new IllegalStateException("No SurfaceManagerFactory set."); - } - return instance; - } - - /** - * Sets the surface manager factory. This may only be called once, and it - * may not be set back to {@code null} when the factory is already - * instantiated. - * - * @param factory the factory to set - */ - public static synchronized void setInstance(SurfaceManagerFactory factory) { - - if (factory == null) { - // We don't want to allow setting this to null at any time. - throw new IllegalArgumentException("factory must be non-null"); - } - - if (instance != null) { - // We don't want to re-set the instance at any time. - throw new IllegalStateException("The surface manager factory is already initialized"); - } - - instance = factory; - } - - /** - * Creates a new instance of a VolatileSurfaceManager given any - * arbitrary SunVolatileImage. An optional context Object can be supplied - * as a way for the caller to pass pipeline-specific context data to - * the VolatileSurfaceManager (such as a backbuffer handle, for example). - */ - public abstract VolatileSurfaceManager - createVolatileManager(SunVolatileImage image, Object context); -} diff --git a/src/java.desktop/share/classes/sun/java2d/opengl/OGLGraphicsConfig.java b/src/java.desktop/share/classes/sun/java2d/opengl/OGLGraphicsConfig.java index 252644b7e49f4..a090458801943 100644 --- a/src/java.desktop/share/classes/sun/java2d/opengl/OGLGraphicsConfig.java +++ b/src/java.desktop/share/classes/sun/java2d/opengl/OGLGraphicsConfig.java @@ -35,7 +35,7 @@ * methods directly from OGLSurfaceData. */ interface OGLGraphicsConfig extends - AccelGraphicsConfig, SurfaceManager.ProxiedGraphicsConfig + AccelGraphicsConfig, SurfaceManager.ProxiedGraphicsConfig, SurfaceManager.Factory { OGLContext getContext(); long getNativeConfigInfo(); diff --git a/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java b/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java index ba06574cdd708..86cc9e39f6f43 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java @@ -47,6 +47,7 @@ import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; import sun.awt.image.SurfaceManager; +import sun.awt.image.VolatileSurfaceManager; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; import sun.java2d.SurfaceData; @@ -55,6 +56,7 @@ import sun.java2d.loops.SurfaceType; import sun.java2d.pipe.Region; import sun.java2d.x11.X11SurfaceData; +import sun.java2d.x11.X11VolatileSurfaceManager; /** * This is an implementation of a GraphicsConfiguration object for a @@ -64,7 +66,7 @@ * @see GraphicsDevice */ public class X11GraphicsConfig extends GraphicsConfiguration - implements SurfaceManager.ProxiedGraphicsConfig + implements SurfaceManager.ProxiedGraphicsConfig, SurfaceManager.Factory { private final X11GraphicsDevice device; protected int visual; @@ -500,4 +502,9 @@ public boolean isTranslucencyCapable() { } private native boolean isTranslucencyCapable(long x11ConfigData); + + @Override + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + return new X11VolatileSurfaceManager(image, context); + } } diff --git a/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java b/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java index 82490e88a99d2..c24e311017e80 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java +++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java @@ -41,8 +41,6 @@ import sun.awt.X11.XToolkit; import sun.java2d.SunGraphicsEnvironment; -import sun.java2d.SurfaceManagerFactory; -import sun.java2d.UnixSurfaceManagerFactory; import sun.java2d.xr.XRSurfaceData; /** @@ -124,10 +122,6 @@ private static void initStatic() { XRSurfaceData.initXRSurfaceData(); } } - - // Install the correct surface manager factory. - SurfaceManagerFactory.setInstance(new UnixSurfaceManagerFactory()); - } diff --git a/src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java b/src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java deleted file mode 100644 index 5ab78ee39eefd..0000000000000 --- a/src/java.desktop/unix/classes/sun/java2d/UnixSurfaceManagerFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - -package sun.java2d; - -import java.awt.GraphicsConfiguration; - -import sun.awt.image.SunVolatileImage; -import sun.awt.image.VolatileSurfaceManager; -import sun.java2d.opengl.GLXGraphicsConfig; -import sun.java2d.opengl.GLXVolatileSurfaceManager; -import sun.java2d.x11.X11VolatileSurfaceManager; -import sun.java2d.xr.*; - -/** - * The SurfaceManagerFactory that creates VolatileSurfaceManager - * implementations for the Unix volatile images. - */ -public class UnixSurfaceManagerFactory extends SurfaceManagerFactory { - - /** - * Creates a new instance of a VolatileSurfaceManager given any - * arbitrary SunVolatileImage. An optional context Object can be supplied - * as a way for the caller to pass pipeline-specific context data to - * the VolatileSurfaceManager (such as a backbuffer handle, for example). - * - * For Unix platforms, this method returns either an X11- or a GLX- - * specific VolatileSurfaceManager based on the GraphicsConfiguration - * under which the SunVolatileImage was created. - */ - public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg, - Object context) - { - GraphicsConfiguration gc = vImg.getGraphicsConfig(); - - if (gc instanceof GLXGraphicsConfig) { - return new GLXVolatileSurfaceManager(vImg, context); - } else if(gc instanceof XRGraphicsConfig) { - return new XRVolatileSurfaceManager(vImg, context); - }else { - return new X11VolatileSurfaceManager(vImg, context); - } - } - -} diff --git a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java index 96b0dc491830c..8605b7853a08f 100644 --- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java @@ -49,6 +49,7 @@ import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; import sun.awt.image.SurfaceManager; +import sun.awt.image.VolatileSurfaceManager; import sun.java2d.SunGraphics2D; import sun.java2d.Surface; import sun.java2d.SurfaceData; @@ -413,4 +414,9 @@ public ImageCapabilities getImageCapabilities() { public ContextCapabilities getContextCapabilities() { return oglCaps; } + + @Override + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + return new GLXVolatileSurfaceManager(image, context); + } } diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java index fb2c8ad480108..11e4a2e64206b 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java @@ -30,10 +30,12 @@ import sun.awt.X11GraphicsDevice; import sun.awt.X11GraphicsEnvironment; import sun.awt.image.SurfaceManager; +import sun.awt.image.SunVolatileImage; +import sun.awt.image.VolatileSurfaceManager; import sun.java2d.SurfaceData; public class XRGraphicsConfig extends X11GraphicsConfig implements - SurfaceManager.ProxiedGraphicsConfig { + SurfaceManager.ProxiedGraphicsConfig, SurfaceManager.Factory { private final SurfaceManager.ProxyCache surfaceDataProxyCache = new SurfaceManager.ProxyCache(); private XRGraphicsConfig(X11GraphicsDevice device, int visualnum, @@ -59,4 +61,9 @@ public static XRGraphicsConfig getConfig(X11GraphicsDevice device, public SurfaceManager.ProxyCache getSurfaceDataProxyCache() { return surfaceDataProxyCache; } + + @Override + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + return new XRVolatileSurfaceManager(image, context); + } } diff --git a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java index 09768148f3dc9..2e11d5510590d 100644 --- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java +++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java @@ -35,8 +35,6 @@ import sun.awt.windows.WToolkit; import sun.java2d.SunGraphicsEnvironment; -import sun.java2d.SurfaceManagerFactory; -import sun.java2d.WindowsSurfaceManagerFactory; import sun.java2d.d3d.D3DGraphicsDevice; import sun.java2d.windows.WindowsFlags; @@ -63,9 +61,6 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment { initDisplay(); - // Install correct surface manager factory. - SurfaceManagerFactory.setInstance(new WindowsSurfaceManagerFactory()); - double sx = -1; double sy = -1; if (isUIScaleEnabled()) { diff --git a/src/java.desktop/windows/classes/sun/java2d/WindowsSurfaceManagerFactory.java b/src/java.desktop/windows/classes/sun/java2d/WindowsSurfaceManagerFactory.java deleted file mode 100644 index 4abb8c823f6e9..0000000000000 --- a/src/java.desktop/windows/classes/sun/java2d/WindowsSurfaceManagerFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.java2d; - -import java.awt.GraphicsConfiguration; -import sun.awt.image.BufImgVolatileSurfaceManager; -import sun.awt.image.SunVolatileImage; -import sun.awt.image.VolatileSurfaceManager; -import sun.java2d.d3d.D3DGraphicsConfig; -import sun.java2d.d3d.D3DVolatileSurfaceManager; -import sun.java2d.opengl.WGLGraphicsConfig; -import sun.java2d.opengl.WGLVolatileSurfaceManager; - -/** - * The SurfaceManagerFactory that creates VolatileSurfaceManager - * implementations for the Windows volatile images. - */ -public final class WindowsSurfaceManagerFactory extends SurfaceManagerFactory { - - /** - * Creates a new instance of a VolatileSurfaceManager given any - * arbitrary SunVolatileImage. An optional context Object can be supplied - * as a way for the caller to pass pipeline-specific context data to - * the VolatileSurfaceManager (such as a backbuffer handle, for example). - * - * For Windows platforms, this method returns a Windows-specific - * VolatileSurfaceManager. - */ - @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg, - Object context) - { - GraphicsConfiguration gc = vImg.getGraphicsConfig(); - if (gc instanceof D3DGraphicsConfig) { - return new D3DVolatileSurfaceManager(vImg, context); - } else if (gc instanceof WGLGraphicsConfig) { - return new WGLVolatileSurfaceManager(vImg, context); - } else { - return new BufImgVolatileSurfaceManager(vImg, context); - } - } - -} diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java index aab6b720d6a89..325836521dd4d 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java @@ -39,6 +39,7 @@ import sun.awt.Win32GraphicsConfig; import sun.awt.image.SunVolatileImage; import sun.awt.image.SurfaceManager; +import sun.awt.image.VolatileSurfaceManager; import sun.awt.windows.WComponentPeer; import sun.java2d.Surface; import sun.java2d.SurfaceData; @@ -51,7 +52,7 @@ public final class D3DGraphicsConfig extends Win32GraphicsConfig - implements AccelGraphicsConfig + implements AccelGraphicsConfig, SurfaceManager.Factory { private static ImageCapabilities imageCaps = new D3DImageCaps(); @@ -307,4 +308,9 @@ public D3DContext getContext() { public ContextCapabilities getContextCapabilities() { return device.getContextCapabilities(); } + + @Override + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + return new D3DVolatileSurfaceManager(image, context); + } } diff --git a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java index c6658bf291423..356b9f08cc8fe 100644 --- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java @@ -43,6 +43,7 @@ import sun.awt.Win32GraphicsDevice; import sun.awt.image.SunVolatileImage; import sun.awt.image.SurfaceManager; +import sun.awt.image.VolatileSurfaceManager; import sun.awt.windows.WComponentPeer; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; @@ -432,4 +433,9 @@ public ImageCapabilities getImageCapabilities() { public ContextCapabilities getContextCapabilities() { return oglCaps; } + + @Override + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + return new WGLVolatileSurfaceManager(image, context); + } } From c1e5512099365cdc8e97599252657c3a50293cbd Mon Sep 17 00:00:00 2001 From: Nikita Gubarkov Date: Fri, 25 Apr 2025 16:14:39 +0200 Subject: [PATCH 2/5] fixup! 8355611: Get rid of SurfaceManagerFactory --- .../macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java | 1 + .../macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java index 4d7609d0857d5..5880f2a2ed2d2 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java @@ -29,6 +29,7 @@ import sun.awt.CGraphicsDevice; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; +import sun.awt.image.SurfaceManager; import sun.awt.image.VolatileSurfaceManager; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; diff --git a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java index 380c01a855dc8..843c04d154009 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java @@ -46,6 +46,7 @@ import sun.awt.CGraphicsDevice; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; +import sun.awt.image.SurfaceManager; import sun.awt.image.VolatileSurfaceManager; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; From 0f0dd77c43aff48e8764f03f66c32c26618000c5 Mon Sep 17 00:00:00 2001 From: Nikita Gubarkov Date: Sat, 26 Apr 2025 12:47:14 +0200 Subject: [PATCH 3/5] fixup! 8355611: Get rid of SurfaceManagerFactory Split long lines --- .../classes/sun/java2d/metal/MTLGraphicsConfig.java | 3 ++- .../classes/sun/java2d/opengl/CGLGraphicsConfig.java | 3 ++- .../classes/sun/awt/image/SunVolatileImage.java | 12 +++++++----- .../share/classes/sun/awt/image/SurfaceManager.java | 10 ++++++---- .../unix/classes/sun/awt/X11GraphicsConfig.java | 3 ++- .../classes/sun/java2d/opengl/GLXGraphicsConfig.java | 3 ++- .../unix/classes/sun/java2d/xr/XRGraphicsConfig.java | 3 ++- .../classes/sun/java2d/d3d/D3DGraphicsConfig.java | 3 ++- .../classes/sun/java2d/opengl/WGLGraphicsConfig.java | 3 ++- 9 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java index 5880f2a2ed2d2..e4afec42482ab 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java @@ -376,7 +376,8 @@ public int getMaxTextureHeight() { } @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context) { return new MTLVolatileSurfaceManager(image, context); } } diff --git a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java index 843c04d154009..6022d516bf90f 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java @@ -390,7 +390,8 @@ public int getMaxTextureHeight() { } @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context) { return new CGLVolatileSurfaceManager(image, context); } } diff --git a/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java b/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java index 0faa11ce58c00..4bcd5f6b44313 100644 --- a/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java +++ b/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java @@ -157,11 +157,13 @@ public int getForcedAccelSurfaceType() { return forcedAccelSurfaceType; } - private VolatileSurfaceManager createSurfaceManager(Object context, - ImageCapabilities caps) { - // GraphicsConfig may provide some specific surface manager implementation. - // In case it doesn't, or we were specifically requested to use an unaccelerated - // surface, fall back to the buffered image surface manager. + private VolatileSurfaceManager createSurfaceManager( + Object context, ImageCapabilities caps) { + // GraphicsConfig may provide some specific surface manager + // implementation. + // In case it doesn't, or we were specifically requested to use + // an unaccelerated surface, fall back to the buffered image + // surface manager. if ((caps == null || caps.isAccelerated()) && graphicsConfig instanceof SurfaceManager.Factory factory) { return factory.createVolatileManager(this, context); diff --git a/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java b/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java index 1fa7579529ca6..2f456276922b3 100644 --- a/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java +++ b/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java @@ -191,11 +191,13 @@ public interface Factory { /** * Creates a new instance of a VolatileSurfaceManager given a - * compatible SunVolatileImage. An optional context Object can be supplied - * as a way for the caller to pass pipeline-specific context data to - * the VolatileSurfaceManager (such as a backbuffer handle, for example). + * compatible SunVolatileImage. + * An optional context Object can be supplied as a way for the caller + * to pass pipeline-specific context data to the VolatileSurfaceManager + * (such as a backbuffer handle, for example). */ - VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context); + VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context); } /** diff --git a/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java b/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java index 86cc9e39f6f43..9c7a7d5c376a1 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java @@ -504,7 +504,8 @@ public boolean isTranslucencyCapable() { private native boolean isTranslucencyCapable(long x11ConfigData); @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context) { return new X11VolatileSurfaceManager(image, context); } } diff --git a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java index 8605b7853a08f..cf58142df8cfa 100644 --- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java @@ -416,7 +416,8 @@ public ContextCapabilities getContextCapabilities() { } @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context) { return new GLXVolatileSurfaceManager(image, context); } } diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java index 11e4a2e64206b..094aa0355e6c7 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java @@ -63,7 +63,8 @@ public SurfaceManager.ProxyCache getSurfaceDataProxyCache() { } @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context) { return new XRVolatileSurfaceManager(image, context); } } diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java index 325836521dd4d..8b001317dcaff 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java @@ -310,7 +310,8 @@ public ContextCapabilities getContextCapabilities() { } @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context) { return new D3DVolatileSurfaceManager(image, context); } } diff --git a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java index 356b9f08cc8fe..4d2759b7580b2 100644 --- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java @@ -435,7 +435,8 @@ public ContextCapabilities getContextCapabilities() { } @Override - public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, Object context) { + public VolatileSurfaceManager createVolatileManager(SunVolatileImage image, + Object context) { return new WGLVolatileSurfaceManager(image, context); } } From 82e080561483622006b338e2f731f0515a4eaa37 Mon Sep 17 00:00:00 2001 From: Nikita Gubarkov Date: Sat, 26 Apr 2025 12:51:25 +0200 Subject: [PATCH 4/5] fixup! 8355611: Get rid of SurfaceManagerFactory Split long lines (8339341) --- .../macosx/classes/sun/awt/CGraphicsConfig.java | 3 ++- .../share/classes/sun/awt/image/SurfaceManager.java | 6 ++++-- .../unix/classes/sun/awt/X11GraphicsDevice.java | 6 ++++-- .../unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java | 3 ++- .../unix/classes/sun/java2d/xr/XRGraphicsConfig.java | 3 ++- .../windows/classes/sun/awt/Win32GraphicsDevice.java | 3 ++- .../classes/sun/java2d/opengl/WGLGraphicsConfig.java | 3 ++- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java index 3c09758e87f3b..0ca8510481704 100644 --- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java @@ -41,7 +41,8 @@ public abstract class CGraphicsConfig extends GraphicsConfiguration private final CGraphicsDevice device; private ColorModel colorModel; - private final SurfaceManager.ProxyCache surfaceDataProxyCache = new SurfaceManager.ProxyCache(); + private final SurfaceManager.ProxyCache surfaceDataProxyCache = + new SurfaceManager.ProxyCache(); protected CGraphicsConfig(CGraphicsDevice device) { this.device = device; diff --git a/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java b/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java index 2f456276922b3..9b86d469d984d 100644 --- a/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java +++ b/src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java @@ -218,7 +218,8 @@ public interface ProxiedGraphicsConfig { } public static class ProxyCache { - private final Map map = Collections.synchronizedMap(new WeakHashMap<>()); + private final Map map = + Collections.synchronizedMap(new WeakHashMap<>()); /** * Return a cached SurfaceDataProxy object for a given SurfaceManager. @@ -269,7 +270,8 @@ public synchronized void flush() { void flush(boolean deaccelerate) { synchronized (weakCache) { - Iterator> i = weakCache.values().iterator(); + Iterator> i = + weakCache.values().iterator(); while (i.hasNext()) { SurfaceDataProxy sdp = i.next().get(); if (sdp == null || sdp.flush(deaccelerate)) { diff --git a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java b/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java index 39ecb13c6a4d0..a7ec9ccc9fd63 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java +++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java @@ -62,7 +62,8 @@ public final class X11GraphicsDevice extends GraphicsDevice * therefore methods, which is using this id should be ready to it. */ private volatile int screen; - Map x11ProxyCacheMap = Collections.synchronizedMap(new HashMap<>()); + Map x11ProxyCacheMap = + Collections.synchronizedMap(new HashMap<>()); private static Boolean xrandrExtSupported; private SunDisplayChanger topLevels = new SunDisplayChanger(); @@ -95,7 +96,8 @@ public int getScreen() { } public SurfaceManager.ProxyCache getProxyCacheFor(SurfaceType st) { - return x11ProxyCacheMap.computeIfAbsent(st, unused -> new SurfaceManager.ProxyCache()); + return x11ProxyCacheMap.computeIfAbsent(st, + unused -> new SurfaceManager.ProxyCache()); } /** diff --git a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java index cf58142df8cfa..2ea076f805166 100644 --- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java @@ -73,7 +73,8 @@ public final class GLXGraphicsConfig private long pConfigInfo; private ContextCapabilities oglCaps; private final OGLContext context; - private final SurfaceManager.ProxyCache surfaceDataProxyCache = new SurfaceManager.ProxyCache(); + private final SurfaceManager.ProxyCache surfaceDataProxyCache = + new SurfaceManager.ProxyCache(); private static native long getGLXConfigInfo(int screennum, int visualnum); private static native int getOGLCapabilities(long configInfo); diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java index 094aa0355e6c7..820b0aa3338f8 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java @@ -36,7 +36,8 @@ public class XRGraphicsConfig extends X11GraphicsConfig implements SurfaceManager.ProxiedGraphicsConfig, SurfaceManager.Factory { - private final SurfaceManager.ProxyCache surfaceDataProxyCache = new SurfaceManager.ProxyCache(); + private final SurfaceManager.ProxyCache surfaceDataProxyCache = + new SurfaceManager.ProxyCache(); private XRGraphicsConfig(X11GraphicsDevice device, int visualnum, int depth, int colormap, boolean doubleBuffer) { diff --git a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java index 865fe48085362..fedc7f3898066 100644 --- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java +++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java @@ -89,7 +89,8 @@ public class Win32GraphicsDevice extends GraphicsDevice implements private float scaleX; private float scaleY; - final SurfaceManager.ProxyCache surfaceDataProxyCache = new SurfaceManager.ProxyCache(); + final SurfaceManager.ProxyCache surfaceDataProxyCache = + new SurfaceManager.ProxyCache(); static { diff --git a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java index 4d2759b7580b2..40d2af5c12aa3 100644 --- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java @@ -74,7 +74,8 @@ public final class WGLGraphicsConfig private ContextCapabilities oglCaps; private final OGLContext context; private Object disposerReferent = new Object(); - private final SurfaceManager.ProxyCache surfaceDataProxyCache = new SurfaceManager.ProxyCache(); + private final SurfaceManager.ProxyCache surfaceDataProxyCache = + new SurfaceManager.ProxyCache(); public static native int getDefaultPixFmt(int screennum); private static native boolean initWGL(); From 3741484e1ace996556d5fece05b7d7f6511c3b2e Mon Sep 17 00:00:00 2001 From: Nikita Gubarkov Date: Sat, 26 Apr 2025 13:00:29 +0200 Subject: [PATCH 5/5] fixup! 8355611: Get rid of SurfaceManagerFactory Remove SurfaceManager.Factory interface from XRGraphicsConfig. --- .../unix/classes/sun/java2d/xr/XRGraphicsConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java index 820b0aa3338f8..43f17e11ae122 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java @@ -35,7 +35,7 @@ import sun.java2d.SurfaceData; public class XRGraphicsConfig extends X11GraphicsConfig implements - SurfaceManager.ProxiedGraphicsConfig, SurfaceManager.Factory { + SurfaceManager.ProxiedGraphicsConfig { private final SurfaceManager.ProxyCache surfaceDataProxyCache = new SurfaceManager.ProxyCache();