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 42typedef 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 53typedef struct _GlyphRef { 54 CARD32 signature; 55 GlyphPtr glyph; 56} GlyphRefRec, *GlyphRefPtr; 57 58#define DeletedGlyph ((GlyphPtr) 1) 59 60typedef struct _GlyphHashSet { 61 CARD32 entries; 62 CARD32 size; 63 CARD32 rehash; 64} GlyphHashSetRec, *GlyphHashSetPtr; 65 66typedef struct _GlyphHash { 67 GlyphRefPtr table; 68 GlyphHashSetPtr hashSet; 69 CARD32 tableEntries; 70} GlyphHashRec, *GlyphHashPtr; 71 72typedef 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 86typedef struct _GlyphList { 87 INT16 xOff; 88 INT16 yOff; 89 CARD8 len; 90 PictFormatPtr format; 91} GlyphListRec, *GlyphListPtr; 92 93extern _X_EXPORT void 94GlyphUninit (ScreenPtr pScreen); 95 96extern _X_EXPORT GlyphHashSetPtr 97FindGlyphHashSet (CARD32 filled); 98 99extern _X_EXPORT GlyphRefPtr 100FindGlyphRef (GlyphHashPtr hash, 101 CARD32 signature, 102 Bool match, 103 unsigned char sha1[20]); 104 105extern _X_EXPORT GlyphPtr 106FindGlyphByHash (unsigned char sha1[20], int format); 107 108extern _X_EXPORT int 109HashGlyph (xGlyphInfo *gi, 110 CARD8 *bits, 111 unsigned long size, 112 unsigned char sha1[20]); 113 114extern _X_EXPORT void 115FreeGlyph (GlyphPtr glyph, int format); 116 117extern _X_EXPORT void 118AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id); 119 120extern _X_EXPORT Bool 121DeleteGlyph (GlyphSetPtr glyphSet, Glyph id); 122 123extern _X_EXPORT GlyphPtr 124FindGlyph (GlyphSetPtr glyphSet, Glyph id); 125 126extern _X_EXPORT GlyphPtr 127AllocateGlyph (xGlyphInfo *gi, int format); 128 129extern _X_EXPORT Bool 130AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet); 131 132extern _X_EXPORT Bool 133ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global); 134 135extern _X_EXPORT Bool 136ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change); 137 138extern _X_EXPORT GlyphSetPtr 139AllocateGlyphSet (int fdepth, PictFormatPtr format); 140 141extern _X_EXPORT int 142FreeGlyphSet (pointer value, 143 XID gid); 144 145 146 147#endif /* _GLYPHSTR_H_ */ 148