diff options
author | Kevin E Martin <kem@kem.org> | 2004-06-30 20:06:56 +0000 |
---|---|---|
committer | Kevin E Martin <kem@kem.org> | 2004-06-30 20:06:56 +0000 |
commit | 7976ee51afcad41b611e642d2feb31d805dedcf6 (patch) | |
tree | 218e5c900399e880dd01458154896d011a2ff238 /render/glyph.c | |
parent | d5db59bd79f5d8788b99056bf9d969b5b3ad99e1 (diff) |
Add Distributed Multihead X (DMX) support
Diffstat (limited to 'render/glyph.c')
-rw-r--r-- | render/glyph.c | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/render/glyph.c b/render/glyph.c index 5dd700581..e4c2f689e 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -89,6 +89,50 @@ FindGlyphHashSet (CARD32 filled) return 0; } +static int _GlyphSetPrivateAllocateIndex = 0; + +int +AllocateGlyphSetPrivateIndex (void) +{ + return _GlyphSetPrivateAllocateIndex++; +} + +void +ResetGlyphSetPrivateIndex (void) +{ + _GlyphSetPrivateAllocateIndex = 0; +} + +Bool +_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr) +{ + pointer *new; + + if (n > glyphSet->maxPrivate) { + if (glyphSet->devPrivates && + glyphSet->devPrivates != (pointer)(&glyphSet[1])) { + new = (pointer *) xrealloc (glyphSet->devPrivates, + (n + 1) * sizeof (pointer)); + if (!new) + return FALSE; + } else { + new = (pointer *) xalloc ((n + 1) * sizeof (pointer)); + if (!new) + return FALSE; + if (glyphSet->devPrivates) + memcpy (new, + glyphSet->devPrivates, + (glyphSet->maxPrivate + 1) * sizeof (pointer)); + } + glyphSet->devPrivates = new; + /* Zero out new, uninitialize privates */ + while (++glyphSet->maxPrivate < n) + glyphSet->devPrivates[glyphSet->maxPrivate] = (pointer)0; + } + glyphSet->devPrivates[n] = ptr; + return TRUE; +} + Bool GlyphInit (ScreenPtr pScreen) { @@ -363,15 +407,24 @@ GlyphSetPtr AllocateGlyphSet (int fdepth, PictFormatPtr format) { GlyphSetPtr glyphSet; + int size; if (!globalGlyphs[fdepth].hashSet) { if (!AllocateGlyphHash (&globalGlyphs[fdepth], &glyphHashSets[0])) return FALSE; } - glyphSet = xalloc (sizeof (GlyphSetRec)); + + size = (sizeof (GlyphSetRec) + + (sizeof (pointer) * _GlyphSetPrivateAllocateIndex)); + glyphSet = xalloc (size); if (!glyphSet) return FALSE; + bzero((char *)glyphSet, size); + glyphSet->maxPrivate = _GlyphSetPrivateAllocateIndex - 1; + if (_GlyphSetPrivateAllocateIndex) + glyphSet->devPrivates = (pointer)(&glyphSet[1]); + if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0])) { xfree (glyphSet); @@ -410,6 +463,11 @@ FreeGlyphSet (pointer value, else ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE); xfree (table); + + if (glyphSet->devPrivates && + glyphSet->devPrivates != (pointer)(&glyphSet[1])) + xfree(glyphSet->devPrivates); + xfree (glyphSet); } return Success; |