Skip to content

Commit

Permalink
libfreerdp-core: apply glyph cache v2 patch from Pawel Jakub Dawidek
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Jan 5, 2012
1 parent 5f28591 commit a3df68a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
20 changes: 20 additions & 0 deletions libfreerdp-cache/glyph.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,27 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)

void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2)
{
int i;
rdpGlyph* glyph;
GLYPH_DATA_V2* glyph_data;
rdpCache* cache = context->cache;

for (i = 0; i < (int) cache_glyph_v2->cGlyphs; i++)
{
glyph_data = cache_glyph_v2->glyphData[i];

glyph = Glyph_Alloc(context);

glyph->x = glyph_data->x;
glyph->y = glyph_data->y;
glyph->cx = glyph_data->cx;
glyph->cy = glyph_data->cy;
glyph->aj = glyph_data->aj;
glyph->cb = glyph_data->cb;
Glyph_New(context, glyph);

glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph);
}
}

rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, uint32 id, uint32 index)
Expand Down
6 changes: 5 additions & 1 deletion libfreerdp-core/capabilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,14 @@ void rdp_write_cache_definition(STREAM* s, GLYPH_CACHE_DEFINITION* cache_definit

void rdp_read_glyph_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings)
{
uint16 glyphSupportLevel;

stream_seek(s, 40); /* glyphCache (40 bytes) */
stream_seek_uint32(s); /* fragCache (4 bytes) */
stream_seek_uint16(s); /* glyphSupportLevel (2 bytes) */
stream_read_uint16(s, glyphSupportLevel); /* glyphSupportLevel (2 bytes) */
stream_seek_uint16(s); /* pad2Octets (2 bytes) */

settings->glyphSupportLevel = glyphSupportLevel;
}

/**
Expand Down
9 changes: 6 additions & 3 deletions libfreerdp-core/orders.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ void update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O
update_read_2byte_unsigned(s, &glyph->cx);
update_read_2byte_unsigned(s, &glyph->cy);
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += glyph->cb % 4;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
glyph->aj = (uint8*) xmalloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb);
fast_glyph->glyph_data = glyph;
Expand Down Expand Up @@ -1370,19 +1370,22 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly
glyph = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2));
cache_glyph_v2_order->glyphData[i] = glyph;

stream_read_uint16(s, glyph->cacheIndex);
stream_read_uint8(s, glyph->cacheIndex);
update_read_2byte_signed(s, &glyph->x);
update_read_2byte_signed(s, &glyph->y);
update_read_2byte_unsigned(s, &glyph->cx);
update_read_2byte_unsigned(s, &glyph->cy);

glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += glyph->cb % 4;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;

glyph->aj = (uint8*) xmalloc(glyph->cb);

stream_read(s, glyph->aj, glyph->cb);
}

if (flags & CG_GLYPH_UNICODE_PRESENT)
stream_seek(s, cache_glyph_v2_order->cGlyphs * 2);
}

void update_decompress_brush(STREAM* s, uint8* output, uint8 bpp)
Expand Down

0 comments on commit a3df68a

Please sign in to comment.