mirror of https://github.com/FreeRDP/FreeRDP
libfreerdp-core: implement server-side cache glyph v1/v2
This commit is contained in:
parent
8446c61724
commit
c1f8f3746d
|
@ -585,14 +585,9 @@ static INLINE BOOL update_write_brush(wStream* s, rdpBrush* brush, BYTE fieldFla
|
|||
stream_write_BYTE(s, brush->style);
|
||||
}
|
||||
|
||||
if (fieldFlags & ORDER_FIELD_04)
|
||||
{
|
||||
stream_write_BYTE(s, brush->hatch);
|
||||
}
|
||||
|
||||
if (brush->style & CACHED_BRUSH)
|
||||
{
|
||||
brush->index = brush->hatch;
|
||||
brush->hatch = brush->index;
|
||||
|
||||
brush->bpp = BMF_BPP[brush->style & 0x0F];
|
||||
|
||||
|
@ -600,6 +595,11 @@ static INLINE BOOL update_write_brush(wStream* s, rdpBrush* brush, BYTE fieldFla
|
|||
brush->bpp = 1;
|
||||
}
|
||||
|
||||
if (fieldFlags & ORDER_FIELD_04)
|
||||
{
|
||||
stream_write_BYTE(s, brush->hatch);
|
||||
}
|
||||
|
||||
if (fieldFlags & ORDER_FIELD_05)
|
||||
{
|
||||
brush->data = (BYTE*) brush->p8x8;
|
||||
|
@ -1793,6 +1793,44 @@ BOOL update_read_cache_glyph_order(wStream* s, CACHE_GLYPH_ORDER* cache_glyph_or
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL update_write_cache_glyph_order(wStream* s, CACHE_GLYPH_ORDER* cache_glyph, UINT16* flags)
|
||||
{
|
||||
int i;
|
||||
INT16 lsi16;
|
||||
GLYPH_DATA* glyph;
|
||||
|
||||
stream_write_BYTE(s, cache_glyph->cacheId); /* cacheId (1 byte) */
|
||||
stream_write_BYTE(s, cache_glyph->cGlyphs); /* cGlyphs (1 byte) */
|
||||
|
||||
for (i = 0; i < (int) cache_glyph->cGlyphs; i++)
|
||||
{
|
||||
glyph = &cache_glyph->glyphData[i];
|
||||
|
||||
stream_write_UINT16(s, glyph->cacheIndex); /* cacheIndex (2 bytes) */
|
||||
|
||||
lsi16 = glyph->x;
|
||||
stream_write_UINT16(s, lsi16); /* x (2 bytes) */
|
||||
|
||||
lsi16 = glyph->y;
|
||||
stream_write_UINT16(s, lsi16); /* y (2 bytes) */
|
||||
|
||||
stream_write_UINT16(s, glyph->cx); /* cx (2 bytes) */
|
||||
stream_write_UINT16(s, glyph->cy); /* cy (2 bytes) */
|
||||
|
||||
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
||||
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
|
||||
|
||||
Stream_Write(s, glyph->aj, glyph->cb);
|
||||
}
|
||||
|
||||
if (*flags & CG_GLYPH_UNICODE_PRESENT)
|
||||
{
|
||||
Stream_Zero(s, cache_glyph->cGlyphs * 2);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL update_read_cache_glyph_v2_order(wStream* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2, UINT16 flags)
|
||||
{
|
||||
int i;
|
||||
|
@ -1862,7 +1900,7 @@ BOOL update_write_cache_glyph_v2_order(wStream* s, CACHE_GLYPH_V2_ORDER* cache_g
|
|||
|
||||
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
||||
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
|
||||
stream_write(s, glyph->aj, glyph->cb);
|
||||
Stream_Write(s, glyph->aj, glyph->cb);
|
||||
}
|
||||
|
||||
if (*flags & CG_GLYPH_UNICODE_PRESENT)
|
||||
|
@ -2197,7 +2235,6 @@ BOOL update_read_field_flags(wStream* s, UINT32* fieldFlags, BYTE flags, BYTE fi
|
|||
|
||||
BOOL update_write_field_flags(wStream* s, UINT32 fieldFlags, BYTE flags, BYTE fieldBytes)
|
||||
{
|
||||
int i;
|
||||
BYTE byte;
|
||||
|
||||
if (fieldBytes == 1)
|
||||
|
|
|
@ -225,6 +225,7 @@ BOOL update_write_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache
|
|||
BOOL update_read_cache_bitmap_v3_order(wStream* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order, BOOL compressed, UINT16 flags);
|
||||
BOOL update_read_cache_color_table_order(wStream* s, CACHE_COLOR_TABLE_ORDER* cache_color_table_order, UINT16 flags);
|
||||
BOOL update_read_cache_glyph_order(wStream* s, CACHE_GLYPH_ORDER* cache_glyph_order, UINT16 flags);
|
||||
BOOL update_write_cache_glyph_order(wStream* s, CACHE_GLYPH_ORDER* cache_glyph_order, UINT16* flags);
|
||||
BOOL update_read_cache_glyph_v2_order(wStream* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order, UINT16 flags);
|
||||
BOOL update_write_cache_glyph_v2_order(wStream* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2, UINT16* flags);
|
||||
BOOL update_read_cache_brush_order(wStream* s, CACHE_BRUSH_ORDER* cache_brush_order, UINT16 flags);
|
||||
|
|
|
@ -762,6 +762,35 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
|
|||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s);
|
||||
}
|
||||
|
||||
static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
|
||||
{
|
||||
wStream* s;
|
||||
UINT16 flags;
|
||||
BYTE *bm, *em;
|
||||
INT16 orderLength;
|
||||
rdpRdp* rdp = context->rdp;
|
||||
|
||||
flags = 0;
|
||||
s = fastpath_update_pdu_init(rdp->fastpath);
|
||||
bm = Stream_Pointer(s);
|
||||
|
||||
Stream_Seek(s, 8);
|
||||
update_write_cache_glyph_v2_order(s, cache_glyph, &flags);
|
||||
em = Stream_Pointer(s);
|
||||
|
||||
orderLength = (em - bm) - 13 - 2;
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
||||
stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
stream_write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
||||
Stream_Pointer(s) = em;
|
||||
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s);
|
||||
}
|
||||
|
||||
static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2)
|
||||
{
|
||||
wStream* s;
|
||||
|
@ -925,6 +954,7 @@ void update_register_server_callbacks(rdpUpdate* update)
|
|||
update->primary->MemBlt = update_send_memblt;
|
||||
update->primary->GlyphIndex = update_send_glyph_index;
|
||||
update->secondary->CacheBitmapV2 = update_send_cache_bitmap_v2;
|
||||
update->secondary->CacheGlyph = update_send_cache_glyph;
|
||||
update->secondary->CacheGlyphV2 = update_send_cache_glyph_v2;
|
||||
update->pointer->PointerSystem = update_send_pointer_system;
|
||||
update->pointer->PointerColor = update_send_pointer_color;
|
||||
|
|
Loading…
Reference in New Issue