Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.h
41159 views
/*1* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef MTLGlyphCache_h_Included26#define MTLGlyphCache_h_Included2728#ifdef __cplusplus29extern "C" {30#endif3132#include "jni.h"33#include "fontscalerdefs.h"34#import <Metal/Metal.h>3536typedef void (MTLFlushFunc)();3738typedef struct _MTLCacheCellInfo MTLCacheCellInfo;3940typedef struct {41CacheCellInfo *head;42CacheCellInfo *tail;43id<MTLTexture> texture;44jint width;45jint height;46jint cellWidth;47jint cellHeight;48MTLFlushFunc *Flush;49} MTLGlyphCacheInfo;5051struct _MTLCacheCellInfo {52MTLGlyphCacheInfo *cacheInfo;53struct GlyphInfo *glyphInfo;54// next cell info in the cache's list55MTLCacheCellInfo *next;56// REMIND: find better name?57// next cell info in the glyph's cell list (next Glyph Cache Info)58MTLCacheCellInfo *nextGCI;59jint timesRendered;60jint x;61jint y;62// number of pixels from the left or right edge not considered touched63// by the glyph64jint leftOff;65jint rightOff;66jfloat tx1;67jfloat ty1;68jfloat tx2;69jfloat ty2;70};7172MTLGlyphCacheInfo *73MTLGlyphCache_Init(jint width, jint height,74jint cellWidth, jint cellHeight,75MTLFlushFunc *func);76MTLCacheCellInfo *77MTLGlyphCache_AddGlyph(MTLGlyphCacheInfo *cache, struct GlyphInfo *glyph);78bool79MTLGlyphCache_IsCacheFull(MTLGlyphCacheInfo *cache, GlyphInfo *glyph);80void81MTLGlyphCache_Invalidate(MTLGlyphCacheInfo *cache);82void83MTLGlyphCache_AddCellInfo(struct GlyphInfo *glyph, MTLCacheCellInfo *cellInfo);84void85MTLGlyphCache_RemoveCellInfo(struct GlyphInfo *glyph, MTLCacheCellInfo *cellInfo);86MTLCacheCellInfo *87MTLGlyphCache_GetCellInfoForCache(struct GlyphInfo *glyph,88MTLGlyphCacheInfo *cache);89JNIEXPORT void90MTLGlyphCache_RemoveAllCellInfos(struct GlyphInfo *glyph);91void92MTLGlyphCache_Free(MTLGlyphCacheInfo *cache);9394#ifdef __cplusplus95};96#endif9798#endif /* MTLGlyphCache_h_Included */99100101