libfreerdp-core: fix message queue ids, fix async glyph messages

This commit is contained in:
Marc-André Moreau
2013-02-03 12:41:59 -05:00
parent c54dbd863e
commit db331d64f7
7 changed files with 61 additions and 54 deletions

View File

@@ -22,6 +22,30 @@
#include <freerdp/types.h>
struct _GLYPH_DATA
{
UINT32 cacheIndex;
INT32 x;
INT32 y;
UINT32 cx;
UINT32 cy;
UINT32 cb;
BYTE* aj;
};
typedef struct _GLYPH_DATA GLYPH_DATA;
struct _GLYPH_DATA_V2
{
UINT32 cacheIndex;
INT32 x;
INT32 y;
UINT32 cx;
UINT32 cy;
UINT32 cb;
BYTE* aj;
};
typedef struct _GLYPH_DATA_V2 GLYPH_DATA_V2;
#define BACKMODE_TRANSPARENT 0x0001
#define BACKMODE_OPAQUE 0x0002
@@ -357,7 +381,7 @@ struct _FAST_GLYPH_ORDER
INT32 y;
UINT32 cbData;
BYTE data[256];
void* glyph_data;
GLYPH_DATA_V2 glyphData;
};
typedef struct _FAST_GLYPH_ORDER FAST_GLYPH_ORDER;

View File

@@ -21,6 +21,7 @@
#define FREERDP_UPDATE_SECONDARY_H
#include <freerdp/types.h>
#include <freerdp/primary.h>
#define GLYPH_FRAGMENT_NOP 0x00
#define GLYPH_FRAGMENT_USE 0xFE
@@ -131,45 +132,21 @@ struct _CACHE_COLOR_TABLE_ORDER
};
typedef struct _CACHE_COLOR_TABLE_ORDER CACHE_COLOR_TABLE_ORDER;
struct _GLYPH_DATA
{
UINT32 cacheIndex;
INT32 x;
INT32 y;
UINT32 cx;
UINT32 cy;
UINT32 cb;
BYTE* aj;
};
typedef struct _GLYPH_DATA GLYPH_DATA;
struct _CACHE_GLYPH_ORDER
{
UINT32 cacheId;
UINT32 cGlyphs;
GLYPH_DATA glyphData[255];
GLYPH_DATA glyphData[256];
BYTE* unicodeCharacters;
};
typedef struct _CACHE_GLYPH_ORDER CACHE_GLYPH_ORDER;
struct _GLYPH_DATA_V2
{
UINT32 cacheIndex;
INT32 x;
INT32 y;
UINT32 cx;
UINT32 cy;
UINT32 cb;
BYTE* aj;
};
typedef struct _GLYPH_DATA_V2 GLYPH_DATA_V2;
struct _CACHE_GLYPH_V2_ORDER
{
UINT32 cacheId;
UINT32 flags;
UINT32 cGlyphs;
GLYPH_DATA_V2 glyphData[255];
GLYPH_DATA_V2 glyphData[256];
BYTE* unicodeCharacters;
};
typedef struct _CACHE_GLYPH_V2_ORDER CACHE_GLYPH_V2_ORDER;

View File

@@ -173,6 +173,7 @@ void update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index)
rdpGlyphCache* glyph_cache;
glyph_cache = context->cache->glyph;
update_process_glyph_fragments(context, glyph_index->data, glyph_index->cbData,
glyph_index->cacheId, glyph_index->ulCharInc, glyph_index->flAccel,
glyph_index->backColor, glyph_index->foreColor, glyph_index->x, glyph_index->y,
@@ -184,8 +185,9 @@ void update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index)
void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fast_index)
{
INT32 opLeft, opTop, opRight, opBottom;
INT32 x, y;
INT32 opLeft, opTop;
INT32 opRight, opBottom;
rdpGlyphCache* glyph_cache;
glyph_cache = context->cache->glyph;
@@ -234,12 +236,13 @@ void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fast_index)
void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph)
{
INT32 opLeft, opTop, opRight, opBottom;
INT32 x, y;
GLYPH_DATA_V2* glyph_data;
rdpGlyph* glyph;
rdpCache* cache = context->cache;
BYTE text_data[2];
INT32 opLeft, opTop;
INT32 opRight, opBottom;
GLYPH_DATA_V2* glyph_data;
rdpCache* cache = context->cache;
opLeft = fast_glyph->opLeft;
opTop = fast_glyph->opTop;
@@ -274,21 +277,21 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph)
if (y == -32768)
y = fast_glyph->bkTop;
if (fast_glyph->glyph_data != NULL)
if (fast_glyph->cbData > 1)
{
/* got option font that needs to go into cache */
glyph_data = (GLYPH_DATA_V2*) (fast_glyph->glyph_data);
glyph_data = &fast_glyph->glyphData;
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->aj = glyph_data->aj;
Glyph_New(context, glyph);
glyph_cache_put(cache->glyph, fast_glyph->cacheId, fast_glyph->data[0], glyph);
free(fast_glyph->glyph_data);
fast_glyph->glyph_data = NULL;
}
text_data[0] = fast_glyph->data[0];
@@ -320,8 +323,8 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
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->aj = glyph_data->aj;
Glyph_New(context, glyph);
glyph_cache_put(cache->glyph, cache_glyph->cacheId, glyph_data->cacheIndex, glyph);
@@ -345,8 +348,8 @@ void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_
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->aj = glyph_data->aj;
Glyph_New(context, glyph);
glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph);

View File

@@ -22,11 +22,11 @@
#include <freerdp/freerdp.h>
#define GetMessageType(_id) (_id & 0xF)
#define GetMessageClass(_id) ((_id >> 8) & 0xF)
#define GetMessageType(_id) (_id & 0xFF)
#define GetMessageClass(_id) ((_id >> 16) & 0xFF)
#define MakeMessageId(_class, _type) \
(((_class ##_Class) << 8) | (_class ## _ ## _type))
(((_class ##_Class) << 16) | (_class ## _ ## _type))
/* Update */

View File

@@ -909,8 +909,6 @@ BOOL update_read_glyph_index_order(STREAM* s, ORDER_INFO* orderInfo, GLYPH_INDEX
return TRUE;
}
BOOL update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_ORDER* fast_index)
{
ORDER_FIELD_BYTE(1, fast_index->cacheId);
@@ -942,12 +940,10 @@ BOOL update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_O
return TRUE;
}
BOOL update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_ORDER* fast_glyph)
{
GLYPH_DATA_V2* glyph;
BYTE* phold;
GLYPH_DATA_V2* glyph;
ORDER_FIELD_BYTE(1, fast_glyph->cacheId);
ORDER_FIELD_2BYTE(2, fast_glyph->ulCharInc, fast_glyph->flAccel);
@@ -968,32 +964,40 @@ BOOL update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O
{
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, fast_glyph->cbData);
if (stream_get_left(s) < fast_glyph->cbData)
return FALSE;
memcpy(fast_glyph->data, s->p, fast_glyph->cbData);
phold = s->p;
if (!stream_skip(s, 1))
return FALSE;
if ((fast_glyph->cbData > 1) && (fast_glyph->glyph_data == NULL))
if (fast_glyph->cbData > 1)
{
/* parse optional glyph data */
glyph = (GLYPH_DATA_V2*) malloc(sizeof(GLYPH_DATA_V2));
glyph = &fast_glyph->glyphData;
glyph->cacheIndex = fast_glyph->data[0];
if (!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))
return FALSE;
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
if (stream_get_left(s) < glyph->cb)
return FALSE;
glyph->aj = (BYTE*) malloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb);
fast_glyph->glyph_data = glyph;
}
s->p = phold + fast_glyph->cbData;
}
return TRUE;

View File

@@ -104,6 +104,7 @@ static void* base64_decode(BYTE* s, int length, int* data_len)
if (length % 4)
return NULL;
n[0] = n[1] = n[2] = n[3] = 0;
q = data = (BYTE*) malloc(length / 4 * 3);
for (p = (char*) s; *p; )

View File

@@ -714,13 +714,12 @@ PRIM_STATIC pstatus_t neon_yCbCrToRGB_16s16s_P3P3(
*/
/* ------------------------------------------------------------------------- */
void primitives_init_colors(
const primitives_hints_t *hints,
primitives_t *prims)
void primitives_init_colors(const primitives_hints_t* hints, primitives_t* prims)
{
prims->RGBToRGB_16s8u_P3AC4R = general_RGBToRGB_16s8u_P3AC4R;
prims->yCbCrToRGB_16s16s_P3P3 = general_yCbCrToRGB_16s16s_P3P3;
prims->RGBToYCbCr_16s16s_P3P3 = general_RGBToYCbCr_16s16s_P3P3;
#if defined(WITH_SSE2)
if (hints->x86_flags & PRIM_X86_SSE2_AVAILABLE)
{
@@ -737,8 +736,7 @@ void primitives_init_colors(
}
/* ------------------------------------------------------------------------- */
void primitives_deinit_colors(
primitives_t *prims)
void primitives_deinit_colors(primitives_t* prims)
{
/* Nothing to do. */
}