Exemple #1
0
int
FreeGlyphSet(pointer value, XID gid)
{
    GlyphSetPtr glyphSet = (GlyphSetPtr) value;

    if (--glyphSet->refcnt == 0) {
        CARD32 i, tableSize = glyphSet->hash.hashSet->size;
        GlyphRefPtr table = glyphSet->hash.table;
        GlyphPtr glyph;

        for (i = 0; i < tableSize; i++) {
            glyph = table[i].glyph;
            if (glyph && glyph != DeletedGlyph)
                FreeGlyph(glyph, glyphSet->fdepth);
        }
        if (!globalGlyphs[glyphSet->fdepth].tableEntries) {
            free(globalGlyphs[glyphSet->fdepth].table);
            globalGlyphs[glyphSet->fdepth].table = 0;
            globalGlyphs[glyphSet->fdepth].hashSet = 0;
        }
        else
            ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], 0, TRUE);
        free(table);
        dixFreeObjectWithPrivates(glyphSet, PRIVATE_GLYPHSET);
    }
    return Success;
}
Exemple #2
0
void
AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
{
    GlyphRefPtr gr;
    CARD32 signature;

    CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph top global");
    /* Locate existing matching glyph */
    signature = *(CARD32 *) glyph->sha1;
    gr = FindGlyphRef(&globalGlyphs[glyphSet->fdepth], signature,
                      TRUE, glyph->sha1);
    if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph) {
        FreeGlyphPicture(glyph);
        dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
        glyph = gr->glyph;
    }
    else if (gr->glyph != glyph) {
        gr->glyph = glyph;
        gr->signature = signature;
        globalGlyphs[glyphSet->fdepth].tableEntries++;
    }

    /* Insert/replace glyphset value */
    gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0);
    ++glyph->refcnt;
    if (gr->glyph && gr->glyph != DeletedGlyph)
        FreeGlyph(gr->glyph, glyphSet->fdepth);
    else
        glyphSet->hash.tableEntries++;
    gr->glyph = glyph;
    gr->signature = id;
    CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom");
}
Exemple #3
0
void
FreeGlyph(GlyphPtr glyph, int format)
{
    CheckDuplicates(&globalGlyphs[format], "FreeGlyph");
    if (--glyph->refcnt == 0) {
        GlyphRefPtr gr;
        int i;
        int first;
        CARD32 signature;

        first = -1;
        for (i = 0; i < globalGlyphs[format].hashSet->size; i++)
            if (globalGlyphs[format].table[i].glyph == glyph) {
                if (first != -1)
                    DuplicateRef(glyph, "FreeGlyph check");
                first = i;
            }

        signature = *(CARD32 *) glyph->sha1;
        gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, glyph->sha1);
        if (gr - globalGlyphs[format].table != first)
            DuplicateRef(glyph, "Found wrong one");
        if (gr->glyph && gr->glyph != DeletedGlyph) {
            gr->glyph = DeletedGlyph;
            gr->signature = 0;
            globalGlyphs[format].tableEntries--;
        }

        FreeGlyphPicture(glyph);
        dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
    }
}
Exemple #4
0
void
InitSelections(void)
{
    Selection *pSel, *pNextSel;

    pSel = CurrentSelections;
    while (pSel) {
        pNextSel = pSel->next;
        dixFreeObjectWithPrivates(pSel, PRIVATE_SELECTION);
        pSel = pNextSel;
    }

    CurrentSelections = NULL;
}
Exemple #5
0
/**
 * does the diX part of freeing the characteristics in the GC.
 *
 *  \param value  must conform to DeleteType
 */
int
FreeGC(void *value, XID gid)
{
    GCPtr pGC = (GCPtr) value;

    CloseFont(pGC->font, (Font) 0);
    (*pGC->funcs->DestroyClip) (pGC);

    if (!pGC->tileIsPixel)
        (*pGC->pScreen->DestroyPixmap) (pGC->tile.pixmap);
    if (pGC->stipple)
        (*pGC->pScreen->DestroyPixmap) (pGC->stipple);

    (*pGC->funcs->DestroyGC) (pGC);
    if (pGC->dash != DefaultDash)
        free(pGC->dash);
    dixFreeObjectWithPrivates(pGC, PRIVATE_GC);
    return Success;
}
Exemple #6
0
GlyphPtr
AllocateGlyph(xGlyphInfo * gi, int fdepth)
{
    PictureScreenPtr ps;
    int size;
    GlyphPtr glyph;
    int i;
    int head_size;

    head_size = sizeof(GlyphRec) + screenInfo.numScreens * sizeof(PicturePtr);
    size = (head_size + dixPrivatesSize(PRIVATE_GLYPH));
    glyph = (GlyphPtr) malloc(size);
    if (!glyph)
        return 0;
    glyph->refcnt = 0;
    glyph->size = size + sizeof(xGlyphInfo);
    glyph->info = *gi;
    dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH);

    for (i = 0; i < screenInfo.numScreens; i++) {
        GlyphPicture(glyph)[i] = NULL;
        ps = GetPictureScreenIfSet(screenInfo.screens[i]);

        if (ps) {
            if (!(*ps->RealizeGlyph) (screenInfo.screens[i], glyph))
                goto bail;
        }
    }

    return glyph;

 bail:
    while (i--) {
        ps = GetPictureScreenIfSet(screenInfo.screens[i]);
        if (ps)
            (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph);
    }

    dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
    return 0;
}