First import
[xorg_rtime.git] / xorg-server-1.4 / render / glyphstr.h
blob22150deee04c43747a475a68fe0d51466dbfc018
1 /*
3 * Copyright © 2000 SuSE, Inc.
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of SuSE not be used in advertising or
10 * publicity pertaining to distribution of the software without specific,
11 * written prior permission. SuSE makes no representations about the
12 * suitability of this software for any purpose. It is provided "as is"
13 * without express or implied warranty.
15 * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
17 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
19 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 * Author: Keith Packard, SuSE, Inc.
25 #ifndef _GLYPHSTR_H_
26 #define _GLYPHSTR_H_
28 #include <X11/extensions/renderproto.h>
29 #include "picture.h"
30 #include "screenint.h"
31 #include "regionstr.h"
32 #include "miscstruct.h"
34 #define GlyphFormat1 0
35 #define GlyphFormat4 1
36 #define GlyphFormat8 2
37 #define GlyphFormat16 3
38 #define GlyphFormat32 4
39 #define GlyphFormatNum 5
41 typedef struct _Glyph {
42 CARD32 refcnt;
43 DevUnion *devPrivates;
44 CARD32 size; /* info + bitmap */
45 xGlyphInfo info;
46 /* bits follow */
47 } GlyphRec, *GlyphPtr;
49 typedef struct _GlyphRef {
50 CARD32 signature;
51 GlyphPtr glyph;
52 } GlyphRefRec, *GlyphRefPtr;
54 #define DeletedGlyph ((GlyphPtr) 1)
56 typedef struct _GlyphHashSet {
57 CARD32 entries;
58 CARD32 size;
59 CARD32 rehash;
60 } GlyphHashSetRec, *GlyphHashSetPtr;
62 typedef struct _GlyphHash {
63 GlyphRefPtr table;
64 GlyphHashSetPtr hashSet;
65 CARD32 tableEntries;
66 } GlyphHashRec, *GlyphHashPtr;
68 typedef struct _GlyphSet {
69 CARD32 refcnt;
70 PictFormatPtr format;
71 int fdepth;
72 GlyphHashRec hash;
73 int maxPrivate;
74 pointer *devPrivates;
75 } GlyphSetRec, *GlyphSetPtr;
77 #define GlyphSetGetPrivate(pGlyphSet,n) \
78 ((n) > (pGlyphSet)->maxPrivate ? \
79 (pointer) 0 : \
80 (pGlyphSet)->devPrivates[n])
82 #define GlyphSetSetPrivate(pGlyphSet,n,ptr) \
83 ((n) > (pGlyphSet)->maxPrivate ? \
84 _GlyphSetSetNewPrivate(pGlyphSet, n, ptr) : \
85 ((((pGlyphSet)->devPrivates[n] = (ptr)) != 0) || TRUE))
87 typedef struct _GlyphList {
88 INT16 xOff;
89 INT16 yOff;
90 CARD8 len;
91 PictFormatPtr format;
92 } GlyphListRec, *GlyphListPtr;
94 GlyphHashSetPtr
95 FindGlyphHashSet (CARD32 filled);
97 int
98 AllocateGlyphSetPrivateIndex (void);
100 void
101 ResetGlyphSetPrivateIndex (void);
103 Bool
104 _GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr);
106 void
107 ResetGlyphPrivates (void);
110 AllocateGlyphPrivateIndex (void);
112 Bool
113 AllocateGlyphPrivate (ScreenPtr pScreen,
114 int index2,
115 unsigned amount);
117 Bool
118 GlyphInit (ScreenPtr pScreen);
120 Bool
121 GlyphFinishInit (ScreenPtr pScreen);
123 void
124 GlyphUninit (ScreenPtr pScreen);
126 GlyphHashSetPtr
127 FindGlyphHashSet (CARD32 filled);
129 GlyphRefPtr
130 FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare);
132 CARD32
133 HashGlyph (GlyphPtr glyph);
135 void
136 FreeGlyph (GlyphPtr glyph, int format);
138 void
139 AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id);
141 Bool
142 DeleteGlyph (GlyphSetPtr glyphSet, Glyph id);
144 GlyphPtr
145 FindGlyph (GlyphSetPtr glyphSet, Glyph id);
147 GlyphPtr
148 AllocateGlyph (xGlyphInfo *gi, int format);
150 Bool
151 AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet);
153 Bool
154 ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global);
156 Bool
157 ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change);
159 GlyphSetPtr
160 AllocateGlyphSet (int fdepth, PictFormatPtr format);
163 FreeGlyphSet (pointer value,
164 XID gid);
168 #endif /* _GLYPHSTR_H_ */