コード例 #1
0
ファイル: glyph.c プロジェクト: achrafweb/FreeRDP
BOOL update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cacheGlyphV2)
{
	int i;
	rdpGlyph* glyph;
	GLYPH_DATA_V2* glyphData;
	rdpCache* cache = context->cache;

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

		glyph = Glyph_Alloc(context);
		if (!glyph)
		{
			/* TODO: cleanup perviosly allocated glyph memory in error case */
			return FALSE;
		}

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

		glyph_cache_put(cache->glyph, cacheGlyphV2->cacheId, glyphData->cacheIndex, glyph);
	}
	return TRUE;
}
コード例 #2
0
ファイル: glyph.c プロジェクト: achrafweb/FreeRDP
BOOL update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyph)
{
	int i;
	rdpGlyph* glyph;
	GLYPH_DATA* glyph_data;
	rdpCache* cache = context->cache;

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

		glyph = Glyph_Alloc(context);
		if (!glyph)
			return FALSE;

		glyph->x = glyph_data->x;
		glyph->y = glyph_data->y;
		glyph->cx = glyph_data->cx;
		glyph->cy = glyph_data->cy;
		glyph->cb = glyph_data->cb;
		glyph->aj = glyph_data->aj;
		if (!Glyph_New(context, glyph))
		{
			Glyph_Free(context, glyph);
			return FALSE;
		}

		glyph_cache_put(cache->glyph, cacheGlyph->cacheId, glyph_data->cacheIndex, glyph);
	}
	return TRUE;
}
コード例 #3
0
ファイル: glyph.c プロジェクト: LK2000/FreeRDP
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);

		cache_glyph_v2->glyphData[i] = NULL;
		free(glyph_data);
	}
}
コード例 #4
0
ファイル: glyph.c プロジェクト: achrafweb/FreeRDP
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;
}
コード例 #5
0
ファイル: glyph.c プロジェクト: LK2000/FreeRDP
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);
}