diff options
Diffstat (limited to 'src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java')
-rw-r--r-- | src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java index 89911b8b7a..5606e9855d 100644 --- a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java +++ b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java @@ -42,7 +42,6 @@ import java.awt.image.DataBuffer; import java.awt.image.DirectColorModel; import java.awt.image.VolatileImage; import java.awt.image.WritableRaster; -import java.util.HashMap; import java.util.concurrent.Callable; import sun.awt.CGraphicsConfig; @@ -89,8 +88,6 @@ public final class CGLGraphicsConfig extends CGraphicsConfig int swapInterval); private static native int getOGLCapabilities(long configInfo); - private static final HashMap<Long, Integer> pGCRefCounts = new HashMap<>(); - /** * Returns GL_MAX_TEXTURE_SIZE from the shared opengl context. Must be * called under OGLRQ lock, because this method change current context. @@ -113,7 +110,7 @@ public final class CGLGraphicsConfig extends CGraphicsConfig this.oglCaps = oglCaps; this.maxTextureSize = maxTextureSize; context = new OGLContext(OGLRenderQueue.getInstance(), this); - refPConfigInfo(pConfigInfo); + // add a record to the Disposer so that we destroy the native // CGLGraphicsConfigInfo data when this object goes away Disposer.addRecord(disposerReferent, @@ -193,33 +190,6 @@ public final class CGLGraphicsConfig extends CGraphicsConfig }); } - static void refPConfigInfo(long pConfigInfo) { - synchronized (pGCRefCounts) { - Integer count = pGCRefCounts.get(pConfigInfo); - if (count == null) { - count = 1; - } - else { - count++; - } - pGCRefCounts.put(pConfigInfo, count); - } - } - - static void deRefPConfigInfo(long pConfigInfo) { - synchronized (pGCRefCounts) { - Integer count = pGCRefCounts.get(pConfigInfo); - if (count != null) { - count--; - pGCRefCounts.put(pConfigInfo, count); - if (count == 0) { - OGLRenderQueue.disposeGraphicsConfig(pConfigInfo); - pGCRefCounts.remove(pConfigInfo); - } - } - } - } - public static boolean isCGLAvailable() { return cglAvailable; } @@ -287,7 +257,7 @@ public final class CGLGraphicsConfig extends CGraphicsConfig } public void dispose() { if (pCfgInfo != 0) { - deRefPConfigInfo(pCfgInfo); + OGLRenderQueue.disposeGraphicsConfig(pCfgInfo); pCfgInfo = 0; } } |