1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * 3*4882a593Smuzhiyun * Copyright © 2000 SuSE, Inc. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software and its 6*4882a593Smuzhiyun * documentation for any purpose is hereby granted without fee, provided that 7*4882a593Smuzhiyun * the above copyright notice appear in all copies and that both that 8*4882a593Smuzhiyun * copyright notice and this permission notice appear in supporting 9*4882a593Smuzhiyun * documentation, and that the name of SuSE not be used in advertising or 10*4882a593Smuzhiyun * publicity pertaining to distribution of the software without specific, 11*4882a593Smuzhiyun * written prior permission. SuSE makes no representations about the 12*4882a593Smuzhiyun * suitability of this software for any purpose. It is provided "as is" 13*4882a593Smuzhiyun * without express or implied warranty. 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 16*4882a593Smuzhiyun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE 17*4882a593Smuzhiyun * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18*4882a593Smuzhiyun * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 19*4882a593Smuzhiyun * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 20*4882a593Smuzhiyun * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21*4882a593Smuzhiyun * 22*4882a593Smuzhiyun * Author: Keith Packard, SuSE, Inc. 23*4882a593Smuzhiyun */ 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun #ifndef _GLYPHSTR_H_ 26*4882a593Smuzhiyun #define _GLYPHSTR_H_ 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun #include <X11/extensions/renderproto.h> 29*4882a593Smuzhiyun #include "picture.h" 30*4882a593Smuzhiyun #include "screenint.h" 31*4882a593Smuzhiyun #include "regionstr.h" 32*4882a593Smuzhiyun #include "miscstruct.h" 33*4882a593Smuzhiyun #include "privates.h" 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun #define GlyphFormat1 0 36*4882a593Smuzhiyun #define GlyphFormat4 1 37*4882a593Smuzhiyun #define GlyphFormat8 2 38*4882a593Smuzhiyun #define GlyphFormat16 3 39*4882a593Smuzhiyun #define GlyphFormat32 4 40*4882a593Smuzhiyun #define GlyphFormatNum 5 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun typedef struct _Glyph { 43*4882a593Smuzhiyun CARD32 refcnt; 44*4882a593Smuzhiyun PrivateRec *devPrivates; 45*4882a593Smuzhiyun unsigned char sha1[20]; 46*4882a593Smuzhiyun CARD32 size; /* info + bitmap */ 47*4882a593Smuzhiyun xGlyphInfo info; 48*4882a593Smuzhiyun /* per-screen pixmaps follow */ 49*4882a593Smuzhiyun } GlyphRec, *GlyphPtr; 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun #define GlyphPicture(glyph) ((PicturePtr *) ((glyph) + 1)) 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun typedef struct _GlyphRef { 54*4882a593Smuzhiyun CARD32 signature; 55*4882a593Smuzhiyun GlyphPtr glyph; 56*4882a593Smuzhiyun } GlyphRefRec, *GlyphRefPtr; 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun #define DeletedGlyph ((GlyphPtr) 1) 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun typedef struct _GlyphHashSet { 61*4882a593Smuzhiyun CARD32 entries; 62*4882a593Smuzhiyun CARD32 size; 63*4882a593Smuzhiyun CARD32 rehash; 64*4882a593Smuzhiyun } GlyphHashSetRec, *GlyphHashSetPtr; 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun typedef struct _GlyphHash { 67*4882a593Smuzhiyun GlyphRefPtr table; 68*4882a593Smuzhiyun GlyphHashSetPtr hashSet; 69*4882a593Smuzhiyun CARD32 tableEntries; 70*4882a593Smuzhiyun } GlyphHashRec, *GlyphHashPtr; 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun typedef struct _GlyphSet { 73*4882a593Smuzhiyun CARD32 refcnt; 74*4882a593Smuzhiyun int fdepth; 75*4882a593Smuzhiyun PictFormatPtr format; 76*4882a593Smuzhiyun GlyphHashRec hash; 77*4882a593Smuzhiyun PrivateRec *devPrivates; 78*4882a593Smuzhiyun } GlyphSetRec, *GlyphSetPtr; 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun #define GlyphSetGetPrivate(pGlyphSet,k) \ 81*4882a593Smuzhiyun dixLookupPrivate(&(pGlyphSet)->devPrivates, k) 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun #define GlyphSetSetPrivate(pGlyphSet,k,ptr) \ 84*4882a593Smuzhiyun dixSetPrivate(&(pGlyphSet)->devPrivates, k, ptr) 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun typedef struct _GlyphList { 87*4882a593Smuzhiyun INT16 xOff; 88*4882a593Smuzhiyun INT16 yOff; 89*4882a593Smuzhiyun CARD8 len; 90*4882a593Smuzhiyun PictFormatPtr format; 91*4882a593Smuzhiyun } GlyphListRec, *GlyphListPtr; 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun extern void 94*4882a593Smuzhiyun GlyphUninit(ScreenPtr pScreen); 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun extern GlyphPtr FindGlyphByHash(unsigned char sha1[20], int format); 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun extern int 99*4882a593Smuzhiyun HashGlyph(xGlyphInfo * gi, 100*4882a593Smuzhiyun CARD8 *bits, unsigned long size, unsigned char sha1[20]); 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun extern void 103*4882a593Smuzhiyun AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id); 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun extern Bool 106*4882a593Smuzhiyun DeleteGlyph(GlyphSetPtr glyphSet, Glyph id); 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun extern GlyphPtr FindGlyph(GlyphSetPtr glyphSet, Glyph id); 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun extern GlyphPtr AllocateGlyph(xGlyphInfo * gi, int format); 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun extern Bool 113*4882a593Smuzhiyun ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change); 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun extern GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format); 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun extern int 118*4882a593Smuzhiyun FreeGlyphSet(void *value, XID gid); 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun #define GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 1 /* used for api compat */ 121*4882a593Smuzhiyun extern _X_EXPORT PicturePtr 122*4882a593Smuzhiyun GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen); 123*4882a593Smuzhiyun extern _X_EXPORT void 124*4882a593Smuzhiyun SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture); 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun #endif /* _GLYPHSTR_H_ */ 127