1 /* 2 * 3 * Copyright © 2000 SuSE, Inc. 4 * 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. 14 * 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. 21 * 22 * Author: Keith Packard, SuSE, Inc. 23 */ 24 25 #ifndef _GLYPHSTR_H_ 26 #define _GLYPHSTR_H_ 27 28 #include <X11/extensions/renderproto.h> 29 #include "picture.h" 30 #include "screenint.h" 31 #include "regionstr.h" 32 #include "miscstruct.h" 33 #include "privates.h" 34 35 #define GlyphFormat1 0 36 #define GlyphFormat4 1 37 #define GlyphFormat8 2 38 #define GlyphFormat16 3 39 #define GlyphFormat32 4 40 #define GlyphFormatNum 5 41 42 typedef struct _Glyph { 43 CARD32 refcnt; 44 PrivateRec *devPrivates; 45 unsigned char sha1[20]; 46 CARD32 size; /* info + bitmap */ 47 xGlyphInfo info; 48 /* per-screen pixmaps follow */ 49 } GlyphRec, *GlyphPtr; 50 51 #define GlyphPicture(glyph) ((PicturePtr *) ((glyph) + 1)) 52 53 typedef struct _GlyphRef { 54 CARD32 signature; 55 GlyphPtr glyph; 56 } GlyphRefRec, *GlyphRefPtr; 57 58 #define DeletedGlyph ((GlyphPtr) 1) 59 60 typedef struct _GlyphHashSet { 61 CARD32 entries; 62 CARD32 size; 63 CARD32 rehash; 64 } GlyphHashSetRec, *GlyphHashSetPtr; 65 66 typedef struct _GlyphHash { 67 GlyphRefPtr table; 68 GlyphHashSetPtr hashSet; 69 CARD32 tableEntries; 70 } GlyphHashRec, *GlyphHashPtr; 71 72 typedef struct _GlyphSet { 73 CARD32 refcnt; 74 int fdepth; 75 PictFormatPtr format; 76 GlyphHashRec hash; 77 PrivateRec *devPrivates; 78 } GlyphSetRec, *GlyphSetPtr; 79 80 #define GlyphSetGetPrivate(pGlyphSet,k) \ 81 dixLookupPrivate(&(pGlyphSet)->devPrivates, k) 82 83 #define GlyphSetSetPrivate(pGlyphSet,k,ptr) \ 84 dixSetPrivate(&(pGlyphSet)->devPrivates, k, ptr) 85 86 typedef struct _GlyphList { 87 INT16 xOff; 88 INT16 yOff; 89 CARD8 len; 90 PictFormatPtr format; 91 } GlyphListRec, *GlyphListPtr; 92 93 extern void 94 GlyphUninit(ScreenPtr pScreen); 95 96 extern GlyphPtr FindGlyphByHash(unsigned char sha1[20], int format); 97 98 extern int 99 HashGlyph(xGlyphInfo * gi, 100 CARD8 *bits, unsigned long size, unsigned char sha1[20]); 101 102 extern void 103 AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id); 104 105 extern Bool 106 DeleteGlyph(GlyphSetPtr glyphSet, Glyph id); 107 108 extern GlyphPtr FindGlyph(GlyphSetPtr glyphSet, Glyph id); 109 110 extern GlyphPtr AllocateGlyph(xGlyphInfo * gi, int format); 111 112 extern Bool 113 ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change); 114 115 extern GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format); 116 117 extern int 118 FreeGlyphSet(void *value, XID gid); 119 120 #define GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 1 /* used for api compat */ 121 extern _X_EXPORT PicturePtr 122 GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen); 123 extern _X_EXPORT void 124 SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture); 125 126 #endif /* _GLYPHSTR_H_ */ 127