diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m index 7ff7410fabb7..4808092dbd46 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m @@ -215,37 +215,6 @@ - (BOOL) isCacheFull:(GlyphInfo*) glyph } return JNI_FALSE; } -/** - * Invalidates all cells in the cache. Note that this method does not - * attempt to compact the cache in any way; it just invalidates any cells - * that already exist. - */ -- (void) invalidate -{ - MTLCacheCellInfo *cellinfo; - - J2dTraceLn(J2D_TRACE_INFO, "MTLGlyphCache.invalidate"); - - if (_cacheInfo == NULL) { - return; - } - - // flush any pending vertices that may be depending on the current - // glyph cache layout - if (_cacheInfo->Flush != NULL) { - _cacheInfo->Flush(_cacheInfo->mtlc); - } - - cellinfo = _cacheInfo->head; - while (cellinfo != NULL) { - if (cellinfo->glyphInfo != NULL) { - // if the cell is occupied, notify the base glyph that its - // cached version for this cache is about to be invalidated - MTLGlyphCache_RemoveCellInfo(cellinfo->glyphInfo, cellinfo); - } - cellinfo = cellinfo->next; - } -} /** * Invalidates and frees all cells and the cache itself. The "cache" pointer diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m index 3e78ed5a9c94..1aa57e25b89e 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m @@ -372,17 +372,17 @@ static void DisableColorGlyphPainting(MTLContext *mtlc) { DisableColorGlyphPainting(mtlc); } - if (!MTLTR_ValidateGlyphCache(mtlc, dstOps, JNI_TRUE)) { - return JNI_FALSE; - } - if (rgbOrder != lastRGBOrder) { // need to invalidate the cache in this case; see comments // for lastRGBOrder above - [mtlc.glyphCacheLCD invalidate]; + [mtlc.glyphCacheLCD free]; lastRGBOrder = rgbOrder; } + if (!MTLTR_ValidateGlyphCache(mtlc, dstOps, JNI_TRUE)) { + return JNI_FALSE; + } + glyphMode = MODE_USE_CACHE_LCD; }