glyph-cache: free pixmap, cache entries, cache fragments, and reuse secondary glyph cache buffers

This commit is contained in:
Anthony Tong 2012-01-15 15:35:08 -05:00
parent 277cbc3ccc
commit 2c30b11be2
2 changed files with 36 additions and 11 deletions

View File

@ -392,9 +392,8 @@ void glyph_cache_put(rdpGlyphCache* glyph_cache, uint32 id, uint32 index, rdpGly
if (prevGlyph != NULL)
{
Glyph_Free(glyph_cache->context, prevGlyph);
xfree(prevGlyph->aj);
/* hack jsorg71 */
//Glyph_Free(glyph_cache->context, prevGlyph);
xfree(prevGlyph);
}
@ -469,19 +468,39 @@ rdpGlyphCache* glyph_cache_new(rdpSettings* settings)
return glyph;
}
void glyph_cache_free(rdpGlyphCache* glyph)
void glyph_cache_free(rdpGlyphCache* glyph_cache)
{
if (glyph != NULL)
if (glyph_cache != NULL)
{
int i;
void* fragment;
for (i = 0; i < 10; i++)
{
xfree(glyph->glyphCache[i].entries);
int j;
for (j = 0; j < glyph_cache->glyphCache[i].number; j++)
{
rdpGlyph* glyph;
glyph = glyph_cache->glyphCache[i].entries[j];
if (glyph != NULL)
{
Glyph_Free(glyph_cache->context, glyph);
xfree(glyph->aj);
xfree(glyph);
}
}
xfree(glyph_cache->glyphCache[i].entries);
}
xfree(glyph->fragCache.entries);
for (i = 0; i < 255; i++)
{
fragment = glyph_cache->fragCache.entries[i].fragment;
xfree(fragment);
}
xfree(glyph);
xfree(glyph_cache->fragCache.entries);
xfree(glyph_cache);
}
}

View File

@ -1333,8 +1333,11 @@ void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_ord
for (i = 0; i < (int) cache_glyph_order->cGlyphs; i++)
{
glyph = (GLYPH_DATA*) xmalloc(sizeof(GLYPH_DATA));
cache_glyph_order->glyphData[i] = glyph;
if (cache_glyph_order->glyphData[i] == NULL)
{
cache_glyph_order->glyphData[i] = (GLYPH_DATA*) xmalloc(sizeof(GLYPH_DATA));
}
glyph = cache_glyph_order->glyphData[i];
stream_read_uint16(s, glyph->cacheIndex);
stream_read_uint16(s, lsi16);
@ -1367,8 +1370,11 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly
for (i = 0; i < (int) cache_glyph_v2_order->cGlyphs; i++)
{
glyph = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2));
cache_glyph_v2_order->glyphData[i] = glyph;
if (cache_glyph_v2_order->glyphData[i] == NULL)
{
cache_glyph_v2_order->glyphData[i] = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2));
}
glyph = cache_glyph_v2_order->glyphData[i];
stream_read_uint8(s, glyph->cacheIndex);
update_read_2byte_signed(s, &glyph->x);