Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.h
41159 views
1
/*
2
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
#ifndef MTLGlyphCache_h_Included
27
#define MTLGlyphCache_h_Included
28
29
#ifdef __cplusplus
30
extern "C" {
31
#endif
32
33
#include "jni.h"
34
#include "fontscalerdefs.h"
35
#import <Metal/Metal.h>
36
37
typedef void (MTLFlushFunc)();
38
39
typedef struct _MTLCacheCellInfo MTLCacheCellInfo;
40
41
typedef struct {
42
CacheCellInfo *head;
43
CacheCellInfo *tail;
44
id<MTLTexture> texture;
45
jint width;
46
jint height;
47
jint cellWidth;
48
jint cellHeight;
49
MTLFlushFunc *Flush;
50
} MTLGlyphCacheInfo;
51
52
struct _MTLCacheCellInfo {
53
MTLGlyphCacheInfo *cacheInfo;
54
struct GlyphInfo *glyphInfo;
55
// next cell info in the cache's list
56
MTLCacheCellInfo *next;
57
// REMIND: find better name?
58
// next cell info in the glyph's cell list (next Glyph Cache Info)
59
MTLCacheCellInfo *nextGCI;
60
jint timesRendered;
61
jint x;
62
jint y;
63
// number of pixels from the left or right edge not considered touched
64
// by the glyph
65
jint leftOff;
66
jint rightOff;
67
jfloat tx1;
68
jfloat ty1;
69
jfloat tx2;
70
jfloat ty2;
71
};
72
73
MTLGlyphCacheInfo *
74
MTLGlyphCache_Init(jint width, jint height,
75
jint cellWidth, jint cellHeight,
76
MTLFlushFunc *func);
77
MTLCacheCellInfo *
78
MTLGlyphCache_AddGlyph(MTLGlyphCacheInfo *cache, struct GlyphInfo *glyph);
79
bool
80
MTLGlyphCache_IsCacheFull(MTLGlyphCacheInfo *cache, GlyphInfo *glyph);
81
void
82
MTLGlyphCache_Invalidate(MTLGlyphCacheInfo *cache);
83
void
84
MTLGlyphCache_AddCellInfo(struct GlyphInfo *glyph, MTLCacheCellInfo *cellInfo);
85
void
86
MTLGlyphCache_RemoveCellInfo(struct GlyphInfo *glyph, MTLCacheCellInfo *cellInfo);
87
MTLCacheCellInfo *
88
MTLGlyphCache_GetCellInfoForCache(struct GlyphInfo *glyph,
89
MTLGlyphCacheInfo *cache);
90
JNIEXPORT void
91
MTLGlyphCache_RemoveAllCellInfos(struct GlyphInfo *glyph);
92
void
93
MTLGlyphCache_Free(MTLGlyphCacheInfo *cache);
94
95
#ifdef __cplusplus
96
};
97
#endif
98
99
#endif /* MTLGlyphCache_h_Included */
100
101