--- old/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java 2019-06-14 14:37:34.000000000 +0530 +++ new/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java 2019-06-14 14:37:33.000000000 +0530 @@ -51,11 +51,11 @@ import sun.java2d.Surface; import sun.java2d.SurfaceData; import sun.java2d.opengl.OGLContext.OGLContextCaps; -import sun.java2d.metal.MetalLayer; import sun.java2d.pipe.hw.AccelSurface; import sun.java2d.pipe.hw.AccelTypedVolatileImage; import sun.java2d.pipe.hw.ContextCapabilities; import sun.lwawt.LWComponentPeer; +import sun.lwawt.macosx.CFRetainedResource; import sun.lwawt.macosx.CPlatformView; import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_DOUBLEBUFFERED; @@ -64,7 +64,7 @@ import static sun.java2d.opengl.OGLSurfaceData.TEXTURE; public final class CGLGraphicsConfig extends CGraphicsConfig - implements OGLGraphicsConfig + implements OGLGraphicsConfig { //private static final int kOpenGLSwapInterval = // RuntimeOptions.getCurrentOptions().OpenGLSwapInterval; @@ -111,7 +111,7 @@ // add a record to the Disposer so that we destroy the native // CGLGraphicsConfigInfo data when this object goes away Disposer.addRecord(disposerReferent, - new CGLGCDisposerRecord(pConfigInfo)); + new CGLGCDisposerRecord(pConfigInfo)); } @Override @@ -122,9 +122,9 @@ @Override public SurfaceData createManagedSurface(int w, int h, int transparency) { return CGLSurfaceData.createData(this, w, h, - getColorModel(transparency), - null, - OGLSurfaceData.TEXTURE); + getColorModel(transparency), + null, + OGLSurfaceData.TEXTURE); } public static CGLGraphicsConfig getConfig(CGraphicsDevice device, @@ -195,27 +195,27 @@ public BufferedImage createCompatibleImage(int width, int height) { ColorModel model = new DirectColorModel(24, 0xff0000, 0xff00, 0xff); WritableRaster - raster = model.createCompatibleWritableRaster(width, height); + raster = model.createCompatibleWritableRaster(width, height); return new BufferedImage(model, raster, model.isAlphaPremultiplied(), - null); + null); } @Override public ColorModel getColorModel(int transparency) { switch (transparency) { - case Transparency.OPAQUE: - // REMIND: once the ColorModel spec is changed, this should be - // an opaque premultiplied DCM... - return new DirectColorModel(24, 0xff0000, 0xff00, 0xff); - case Transparency.BITMASK: - return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000); - case Transparency.TRANSLUCENT: - ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); - return new DirectColorModel(cs, 32, - 0xff0000, 0xff00, 0xff, 0xff000000, - true, DataBuffer.TYPE_INT); - default: - return null; + case Transparency.OPAQUE: + // REMIND: once the ColorModel spec is changed, this should be + // an opaque premultiplied DCM... + return new DirectColorModel(24, 0xff0000, 0xff00, 0xff); + case Transparency.BITMASK: + return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000); + case Transparency.TRANSLUCENT: + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); + return new DirectColorModel(cs, 32, + 0xff0000, 0xff00, 0xff, 0xff000000, + true, DataBuffer.TYPE_INT); + default: + return null; } } @@ -265,13 +265,8 @@ } @Override - public SurfaceData createSurfaceData(CGLLayer layer) { - return CGLSurfaceData.createData(layer); - } - - @Override - public SurfaceData createSurfaceData(MetalLayer layer) { - return null; + public SurfaceData createSurfaceData(CFRetainedResource layer) { + return CGLSurfaceData.createData((CGLLayer) layer); } @Override @@ -281,7 +276,7 @@ ColorModel model = getColorModel(Transparency.OPAQUE); WritableRaster wr = model.createCompatibleWritableRaster(width, height); return new OffScreenImage(target, model, wr, - model.isAlphaPremultiplied()); + model.isAlphaPremultiplied()); } @Override @@ -312,7 +307,7 @@ final int w = Math.max(1, r.width); final int h = Math.max(1, r.height); final int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT - : Transparency.OPAQUE; + : Transparency.OPAQUE; return new SunVolatileImage(this, w, h, transparency, null); } @@ -338,7 +333,7 @@ try { bg.setBackground(peer.getBackground()); bg.clearRect(0, 0, backBuffer.getWidth(null), - backBuffer.getHeight(null)); + backBuffer.getHeight(null)); } finally { bg.dispose(); } @@ -348,7 +343,7 @@ private static class CGLBufferCaps extends BufferCapabilities { public CGLBufferCaps(boolean dblBuf) { super(imageCaps, imageCaps, - dblBuf ? FlipContents.UNDEFINED : null); + dblBuf ? FlipContents.UNDEFINED : null); } } @@ -384,10 +379,10 @@ return null; } SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, - transparency, type); + transparency, type); Surface sd = vi.getDestSurface(); if (!(sd instanceof AccelSurface) || - ((AccelSurface)sd).getType() != type) + ((AccelSurface)sd).getType() != type) { vi.flush(); vi = null; @@ -404,12 +399,12 @@ @Override public int getMaxTextureWidth() { return Math.max(maxTextureSize / getDevice().getScaleFactor(), - getBounds().width); + getBounds().width); } @Override public int getMaxTextureHeight() { return Math.max(maxTextureSize / getDevice().getScaleFactor(), - getBounds().height); + getBounds().height); } }