Beispiel #1
0
static BOOL update_gdi_glyph_index(rdpContext* context,
                                   GLYPH_INDEX_ORDER* glyphIndex)
{
	INT32 bkWidth = 0, bkHeight = 0, opWidth = 0, opHeight = 0;

	if (!context || !glyphIndex || !context->cache)
		return FALSE;

	if (glyphIndex->bkRight > glyphIndex->bkLeft)
		bkWidth = glyphIndex->bkRight - glyphIndex->bkLeft + 1;

	if (glyphIndex->opRight > glyphIndex->opLeft)
		opWidth = glyphIndex->opRight - glyphIndex->opLeft + 1;

	if (glyphIndex->bkBottom > glyphIndex->bkTop)
		bkHeight = glyphIndex->bkBottom - glyphIndex->bkTop + 1;

	if (glyphIndex->opBottom > glyphIndex->opTop)
		opHeight = glyphIndex->opBottom - glyphIndex->opTop + 1;

	return update_process_glyph_fragments(context, glyphIndex->data,
	                                      glyphIndex->cbData,
	                                      glyphIndex->cacheId, glyphIndex->ulCharInc, glyphIndex->flAccel,
	                                      glyphIndex->backColor, glyphIndex->foreColor, glyphIndex->x, glyphIndex->y,
	                                      glyphIndex->bkLeft, glyphIndex->bkTop, bkWidth, bkHeight,
	                                      glyphIndex->opLeft, glyphIndex->opTop, opWidth, opHeight,
	                                      glyphIndex->fOpRedundant);
}
Beispiel #2
0
void update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyphIndex)
{
	rdpGlyphCache* glyph_cache;
	int bkWidth, bkHeight, opWidth, opHeight;

	glyph_cache = context->cache->glyph;

	bkWidth = glyphIndex->bkRight - glyphIndex->bkLeft;
	opWidth = glyphIndex->opRight - glyphIndex->opLeft;
	bkHeight = glyphIndex->bkBottom - glyphIndex->bkTop;
	opHeight = glyphIndex->opBottom - glyphIndex->opTop;

	if (glyphIndex->opRight > context->settings->DesktopWidth)
	{
		/**
		 * Some Microsoft servers send erroneous high values close to the
		 * sint16 maximum in the OpRight field of this drawing order.
		 * (One example where this can be seen is in notepad when connected to
		 * Windows XP with disabled fast index and fast glyph capabilities.)
		 * This workaround prevents resulting problems in the UI callbacks.
		 */
		opWidth = context->settings->DesktopWidth - glyphIndex->opLeft;
	}

	update_process_glyph_fragments(context, glyphIndex->data, glyphIndex->cbData,
			glyphIndex->cacheId, glyphIndex->ulCharInc, glyphIndex->flAccel,
			glyphIndex->backColor, glyphIndex->foreColor, glyphIndex->x, glyphIndex->y,
			glyphIndex->bkLeft, glyphIndex->bkTop, bkWidth, bkHeight,
			glyphIndex->opLeft, glyphIndex->opTop, opWidth, opHeight,
			glyphIndex->fOpRedundant);
}
Beispiel #3
0
BOOL update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fastIndex)
{
    INT32 x, y;
    INT32 opLeft, opTop;
    INT32 opRight, opBottom;
    rdpGlyphCache* glyph_cache;

    glyph_cache = context->cache->glyph;

    opLeft = fastIndex->opLeft;
    opTop = fastIndex->opTop;
    opRight = fastIndex->opRight;
    opBottom = fastIndex->opBottom;
    x = fastIndex->x;
    y = fastIndex->y;

    if (opBottom == -32768)
    {
        BYTE flags = (BYTE) (opTop & 0x0F);

        if (flags & 0x01)
            opBottom = fastIndex->bkBottom;
        if (flags & 0x02)
            opRight = fastIndex->bkRight;
        if (flags & 0x04)
            opTop = fastIndex->bkTop;
        if (flags & 0x08)
            opLeft = fastIndex->bkLeft;
    }

    if (opLeft == 0)
        opLeft = fastIndex->bkLeft;

    if (opRight == 0)
        opRight = fastIndex->bkRight;

    if (x == -32768)
        x = fastIndex->bkLeft;

    if (y == -32768)
        y = fastIndex->bkTop;

    update_process_glyph_fragments(context, fastIndex->data, fastIndex->cbData,
                                   fastIndex->cacheId, fastIndex->ulCharInc, fastIndex->flAccel,
                                   fastIndex->backColor, fastIndex->foreColor, x, y,
                                   fastIndex->bkLeft, fastIndex->bkTop,
                                   fastIndex->bkRight - fastIndex->bkLeft, fastIndex->bkBottom - fastIndex->bkTop,
                                   opLeft, opTop,
                                   opRight - opLeft, opBottom - opTop,
                                   FALSE);
    return TRUE;
}
Beispiel #4
0
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,
			glyph_index->bkLeft, glyph_index->bkTop,
			glyph_index->bkRight - glyph_index->bkLeft, glyph_index->bkBottom - glyph_index->bkTop,
			glyph_index->opLeft, glyph_index->opTop,
			glyph_index->opRight - glyph_index->opLeft, glyph_index->opBottom - glyph_index->opTop);
}
Beispiel #5
0
BOOL update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyphIndex)
{
	rdpGlyphCache* glyph_cache;
	int bkWidth, bkHeight, opWidth, opHeight;

	glyph_cache = context->cache->glyph;

	bkWidth = glyphIndex->bkRight - glyphIndex->bkLeft;
	opWidth = glyphIndex->opRight - glyphIndex->opLeft;
	bkHeight = glyphIndex->bkBottom - glyphIndex->bkTop;
	opHeight = glyphIndex->opBottom - glyphIndex->opTop;

	return update_process_glyph_fragments(context, glyphIndex->data, glyphIndex->cbData,
			glyphIndex->cacheId, glyphIndex->ulCharInc, glyphIndex->flAccel,
			glyphIndex->backColor, glyphIndex->foreColor, glyphIndex->x, glyphIndex->y,
			glyphIndex->bkLeft, glyphIndex->bkTop, bkWidth, bkHeight,
			glyphIndex->opLeft, glyphIndex->opTop, opWidth, opHeight,
			glyphIndex->fOpRedundant);
}
Beispiel #6
0
BOOL update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph)
{
	INT32 x, y;
	rdpGlyph* glyph;
	BYTE text_data[2];
	INT32 opLeft, opTop;
	INT32 opRight, opBottom;
	GLYPH_DATA_V2* glyphData;
	rdpCache* cache = context->cache;

	opLeft = fastGlyph->opLeft;
	opTop = fastGlyph->opTop;
	opRight = fastGlyph->opRight;
	opBottom = fastGlyph->opBottom;
	x = fastGlyph->x;
	y = fastGlyph->y;

	if (opBottom == -32768)
	{
		BYTE flags = (BYTE) (opTop & 0x0F);

		if (flags & 0x01)
			opBottom = fastGlyph->bkBottom;
		if (flags & 0x02)
			opRight = fastGlyph->bkRight;
		if (flags & 0x04)
			opTop = fastGlyph->bkTop;
		if (flags & 0x08)
			opLeft = fastGlyph->bkLeft;
	}

	if (opLeft == 0)
		opLeft = fastGlyph->bkLeft;

	if (opRight == 0)
		opRight = fastGlyph->bkRight;

	if (x == -32768)
		x = fastGlyph->bkLeft;

	if (y == -32768)
		y = fastGlyph->bkTop;

	if ((fastGlyph->cbData > 1) && (fastGlyph->glyphData.aj))
	{
		/* got option font that needs to go into cache */
		glyphData = &fastGlyph->glyphData;

		glyph = Glyph_Alloc(context);
		if (!glyph)
			return FALSE;
		glyph->x = glyphData->x;
		glyph->y = glyphData->y;
		glyph->cx = glyphData->cx;
		glyph->cy = glyphData->cy;
		glyph->cb = glyphData->cb;
		glyph->aj = malloc(glyphData->cb);
		if (!glyph->aj)
			goto error_aj;
		CopyMemory(glyph->aj, glyphData->aj, glyph->cb);

		if (!Glyph_New(context, glyph))
			goto error_glyph_new;

		glyph_cache_put(cache->glyph, fastGlyph->cacheId, fastGlyph->data[0], glyph);
	}

	text_data[0] = fastGlyph->data[0];
	text_data[1] = 0;

	return update_process_glyph_fragments(context, text_data, 1,
			fastGlyph->cacheId, fastGlyph->ulCharInc, fastGlyph->flAccel,
			fastGlyph->backColor, fastGlyph->foreColor, x, y,
			fastGlyph->bkLeft, fastGlyph->bkTop,
			fastGlyph->bkRight - fastGlyph->bkLeft, fastGlyph->bkBottom - fastGlyph->bkTop,
			opLeft, opTop,
			opRight - opLeft, opBottom - opTop,
			FALSE);

error_glyph_new:
	free(glyph->aj);
	glyph->aj = NULL;
error_aj:
	Glyph_Free(context, glyph);
	return FALSE;
}
Beispiel #7
0
static BOOL update_gdi_fast_glyph(rdpContext* context,
                                  const FAST_GLYPH_ORDER* fastGlyph)
{
	INT32 x, y;
	BYTE text_data[2];
	INT32 opLeft, opTop;
	INT32 opRight, opBottom;
	INT32 opWidth = 0, opHeight = 0;
	INT32 bkWidth = 0, bkHeight = 0;
	rdpCache* cache;

	if (!context || !fastGlyph || !context->cache)
		return FALSE;

	cache = context->cache;
	opLeft = fastGlyph->opLeft;
	opTop = fastGlyph->opTop;
	opRight = fastGlyph->opRight;
	opBottom = fastGlyph->opBottom;
	x = fastGlyph->x;
	y = fastGlyph->y;

	if (opBottom == -32768)
	{
		BYTE flags = (BYTE)(opTop & 0x0F);

		if (flags & 0x01)
			opBottom = fastGlyph->bkBottom;

		if (flags & 0x02)
			opRight = fastGlyph->bkRight;

		if (flags & 0x04)
			opTop = fastGlyph->bkTop;

		if (flags & 0x08)
			opLeft = fastGlyph->bkLeft;
	}

	if (opLeft == 0)
		opLeft = fastGlyph->bkLeft;

	if (opRight == 0)
		opRight = fastGlyph->bkRight;

	/* See update_gdi_fast_index opRight comment. */
	if (opRight > context->instance->settings->DesktopWidth)
		opRight = context->instance->settings->DesktopWidth;

	if (x == -32768)
		x = fastGlyph->bkLeft;

	if (y == -32768)
		y = fastGlyph->bkTop;

	if ((fastGlyph->cbData > 1) && (fastGlyph->glyphData.aj))
	{
		/* got option font that needs to go into cache */
		rdpGlyph* glyph;
		const GLYPH_DATA_V2* glyphData = &fastGlyph->glyphData;

		if (!glyphData)
			return FALSE;

		glyph = Glyph_Alloc(context, glyphData->x, glyphData->y, glyphData->cx,
		                    glyphData->cy,
		                    glyphData->cb, glyphData->aj);

		if (!glyph)
			return FALSE;

		if (!glyph_cache_put(cache->glyph, fastGlyph->cacheId, fastGlyph->data[0],
		                     glyph))
		{
			glyph->Free(context, glyph);
			return FALSE;
		}
	}

	text_data[0] = fastGlyph->data[0];
	text_data[1] = 0;

	if (fastGlyph->bkRight > fastGlyph->bkLeft)
		bkWidth = fastGlyph->bkRight - fastGlyph->bkLeft + 1;

	if (fastGlyph->bkBottom > fastGlyph->bkTop)
		bkHeight = fastGlyph->bkBottom - fastGlyph->bkTop + 1;

	if (opRight > opLeft)
		opWidth = opRight - opLeft + 1;

	if (opBottom > opTop)
		opHeight = opBottom - opTop + 1;

	return update_process_glyph_fragments(context, text_data, 1,
	                                      fastGlyph->cacheId, fastGlyph->ulCharInc, fastGlyph->flAccel,
	                                      fastGlyph->backColor, fastGlyph->foreColor, x, y,
	                                      fastGlyph->bkLeft, fastGlyph->bkTop,
	                                      bkWidth, bkHeight, opLeft, opTop,
	                                      opWidth, opHeight, FALSE);
}
Beispiel #8
0
static BOOL update_gdi_fast_index(rdpContext* context,
                                  const FAST_INDEX_ORDER* fastIndex)
{
	INT32 x, y;
	INT32 opLeft, opTop;
	INT32 opRight, opBottom;
	INT32 opWidth = 0, opHeight = 0;
	INT32 bkWidth = 0, bkHeight = 0;

	if (!context || !fastIndex || !context->cache)
		return FALSE;

	opLeft = fastIndex->opLeft;
	opTop = fastIndex->opTop;
	opRight = fastIndex->opRight;
	opBottom = fastIndex->opBottom;
	x = fastIndex->x;
	y = fastIndex->y;

	if (opBottom == -32768)
	{
		BYTE flags = (BYTE)(opTop & 0x0F);

		if (flags & 0x01)
			opBottom = fastIndex->bkBottom;

		if (flags & 0x02)
			opRight = fastIndex->bkRight;

		if (flags & 0x04)
			opTop = fastIndex->bkTop;

		if (flags & 0x08)
			opLeft = fastIndex->bkLeft;
	}

	if (opLeft == 0)
		opLeft = fastIndex->bkLeft;

	if (opRight == 0)
		opRight = fastIndex->bkRight;

	/* Server can send a massive number (32766) which appears to be
	 * undocumented special behavior for "Erase all the way right".
	 * X11 has nondeterministic results asking for a draw that wide. */
	if (opRight > context->instance->settings->DesktopWidth)
		opRight = context->instance->settings->DesktopWidth;

	if (x == -32768)
		x = fastIndex->bkLeft;

	if (y == -32768)
		y = fastIndex->bkTop;

	if (fastIndex->bkRight > fastIndex->bkLeft)
		bkWidth = fastIndex->bkRight - fastIndex->bkLeft + 1;

	if (fastIndex->bkBottom > fastIndex->bkTop)
		bkHeight = fastIndex->bkBottom - fastIndex->bkTop + 1;

	if (opRight > opLeft)
		opWidth = opRight - opLeft + 1;

	if (opBottom > opTop)
		opHeight = opBottom - opTop + 1;

	return update_process_glyph_fragments(context, fastIndex->data,
	                                      fastIndex->cbData,
	                                      fastIndex->cacheId, fastIndex->ulCharInc, fastIndex->flAccel,
	                                      fastIndex->backColor, fastIndex->foreColor, x, y,
	                                      fastIndex->bkLeft, fastIndex->bkTop, bkWidth, bkHeight,
	                                      opLeft, opTop, opWidth, opHeight, FALSE);
}
Beispiel #9
0
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];

	opLeft = fast_glyph->opLeft;
	opTop = fast_glyph->opTop;
	opRight = fast_glyph->opRight;
	opBottom = fast_glyph->opBottom;
	x = fast_glyph->x;
	y = fast_glyph->y;

	if (opBottom == -32768)
	{
		BYTE flags = (BYTE) (opTop & 0x0F);

		if (flags & 0x01)
			opBottom = fast_glyph->bkBottom;
		if (flags & 0x02)
			opRight = fast_glyph->bkRight;
		if (flags & 0x04)
			opTop = fast_glyph->bkTop;
		if (flags & 0x08)
			opLeft = fast_glyph->bkLeft;
	}

	if (opLeft == 0)
		opLeft = fast_glyph->bkLeft;

	if (opRight == 0)
		opRight = fast_glyph->bkRight;

	if (x == -32768)
		x = fast_glyph->bkLeft;

	if (y == -32768)
		y = fast_glyph->bkTop;

	if (fast_glyph->glyph_data != NULL)
	{
		/* got option font that needs to go into cache */
		glyph_data = (GLYPH_DATA_V2*) (fast_glyph->glyph_data);
		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, 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];
	text_data[1] = 0;

	update_process_glyph_fragments(context, text_data, 1,
			fast_glyph->cacheId, fast_glyph->ulCharInc, fast_glyph->flAccel,
			fast_glyph->backColor, fast_glyph->foreColor, x, y,
			fast_glyph->bkLeft, fast_glyph->bkTop,
			fast_glyph->bkRight - fast_glyph->bkLeft, fast_glyph->bkBottom - fast_glyph->bkTop,
			opLeft, opTop,
			opRight - opLeft, opBottom - opTop);
}