glyphstr.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. #ifndef _GLYPHSTR_H_
  25. #define _GLYPHSTR_H_
  26. #include <X11/extensions/renderproto.h>
  27. #include "picture.h"
  28. #include "screenint.h"
  29. #include "regionstr.h"
  30. #include "miscstruct.h"
  31. #define GlyphFormat1 0
  32. #define GlyphFormat4 1
  33. #define GlyphFormat8 2
  34. #define GlyphFormat16 3
  35. #define GlyphFormat32 4
  36. #define GlyphFormatNum 5
  37. typedef struct _Glyph {
  38. CARD32 refcnt;
  39. DevUnion *devPrivates;
  40. CARD32 size; /* info + bitmap */
  41. xGlyphInfo info;
  42. /* bits follow */
  43. } GlyphRec, *GlyphPtr;
  44. typedef struct _GlyphRef {
  45. CARD32 signature;
  46. GlyphPtr glyph;
  47. } GlyphRefRec, *GlyphRefPtr;
  48. #define DeletedGlyph ((GlyphPtr) 1)
  49. typedef struct _GlyphHashSet {
  50. CARD32 entries;
  51. CARD32 size;
  52. CARD32 rehash;
  53. } GlyphHashSetRec, *GlyphHashSetPtr;
  54. typedef struct _GlyphHash {
  55. GlyphRefPtr table;
  56. GlyphHashSetPtr hashSet;
  57. CARD32 tableEntries;
  58. } GlyphHashRec, *GlyphHashPtr;
  59. typedef struct _GlyphSet {
  60. CARD32 refcnt;
  61. PictFormatPtr format;
  62. int fdepth;
  63. GlyphHashRec hash;
  64. int maxPrivate;
  65. pointer *devPrivates;
  66. } GlyphSetRec, *GlyphSetPtr;
  67. #define GlyphSetGetPrivate(pGlyphSet,n) \
  68. ((n) > (pGlyphSet)->maxPrivate ? \
  69. (pointer) 0 : \
  70. (pGlyphSet)->devPrivates[n])
  71. #define GlyphSetSetPrivate(pGlyphSet,n,ptr) \
  72. ((n) > (pGlyphSet)->maxPrivate ? \
  73. _GlyphSetSetNewPrivate(pGlyphSet, n, ptr) : \
  74. ((((pGlyphSet)->devPrivates[n] = (ptr)) != 0) || TRUE))
  75. typedef struct _GlyphList {
  76. INT16 xOff;
  77. INT16 yOff;
  78. CARD8 len;
  79. PictFormatPtr format;
  80. } GlyphListRec, *GlyphListPtr;
  81. extern GlyphHashRec globalGlyphs[GlyphFormatNum];
  82. GlyphHashSetPtr FindGlyphHashSet(CARD32 filled);
  83. void
  84. ResetGlyphSetPrivateIndex(void);
  85. Bool
  86. _GlyphSetSetNewPrivate(GlyphSetPtr glyphSet, int n, pointer ptr);
  87. Bool
  88. GlyphInit(ScreenPtr pScreen);
  89. Bool
  90. GlyphFinishInit(ScreenPtr pScreen);
  91. void
  92. GlyphUninit(ScreenPtr pScreen);
  93. GlyphHashSetPtr FindGlyphHashSet(CARD32 filled);
  94. GlyphRefPtr
  95. FindGlyphRef(GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare);
  96. CARD32
  97. HashGlyph(GlyphPtr glyph);
  98. void
  99. FreeGlyph(GlyphPtr glyph, int format);
  100. void
  101. AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id);
  102. Bool
  103. DeleteGlyph(GlyphSetPtr glyphSet, Glyph id);
  104. GlyphPtr FindGlyph(GlyphSetPtr glyphSet, Glyph id);
  105. GlyphPtr AllocateGlyph(xGlyphInfo * gi, int format);
  106. Bool
  107. AllocateGlyphHash(GlyphHashPtr hash, GlyphHashSetPtr hashSet);
  108. Bool
  109. ResizeGlyphHash(GlyphHashPtr hash, CARD32 change, Bool global);
  110. Bool
  111. ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change);
  112. GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format);
  113. int
  114. FreeGlyphSet(pointer value, XID gid);
  115. #endif /* _GLYPHSTR_H_ */