libfreerdp-core: improving parsing if fast index order

This commit is contained in:
Marc-André Moreau 2011-09-20 15:30:52 -04:00
parent f643fa5435
commit 6f2575c076
3 changed files with 37 additions and 32 deletions

View File

@ -531,8 +531,8 @@ void xf_gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
int x, y;
Pixmap bmp;
Pixmap* bmps;
uint32 fg_color;
uint32 bg_color;
uint32 fgcolor;
uint32 bgcolor;
GLYPH_DATA* glyph;
GLYPH_DATA** glyphs;
GLYPH_FRAGMENT* fragment;
@ -541,14 +541,13 @@ void xf_gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
x = fast_index->bkLeft;
y = fast_index->y;
fg_color = freerdp_color_convert(fast_index->foreColor, 32, xfi->bpp, xfi->clrconv);
bg_color = freerdp_color_convert(fast_index->backColor, 32, xfi->bpp, xfi->clrconv);
fgcolor = freerdp_color_convert(fast_index->foreColor, xfi->srcBpp, 32, xfi->clrconv);
bgcolor = freerdp_color_convert(fast_index->backColor, xfi->srcBpp, 32, xfi->clrconv);
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetForeground(xfi->display, xfi->gc, bg_color);
XSetBackground(xfi->display, xfi->gc, fg_color);
XSetForeground(xfi->display, xfi->gc, bgcolor);
XSetBackground(xfi->display, xfi->gc, fgcolor);
#if 0
if (fast_index->opaqueRect)
{
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
@ -562,7 +561,6 @@ void xf_gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
fast_index->opRight - fast_index->opLeft + 1, fast_index->opBottom - fast_index->opTop + 1);
}
}
#endif
XSetFillStyle(xfi->display, xfi->gc, FillStippled);

View File

@ -1131,10 +1131,7 @@ void update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_O
update_read_coord(s, &fast_index->bkBottom, orderInfo->deltaCoordinates);
if (orderInfo->fieldFlags & ORDER_FIELD_09)
{
update_read_coord(s, &fast_index->opLeft, orderInfo->deltaCoordinates);
fast_index->opaqueRect = True;
}
if (orderInfo->fieldFlags & ORDER_FIELD_10)
update_read_coord(s, &fast_index->opTop, orderInfo->deltaCoordinates);
@ -1151,30 +1148,25 @@ void update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_O
if (orderInfo->fieldFlags & ORDER_FIELD_14)
update_read_coord(s, &fast_index->y, orderInfo->deltaCoordinates);
if (fast_index->opRight == 0)
fast_index->opRight = fast_index->bkRight;
if (fast_index->opBottom == -32768)
{
if ((fast_index->opTop & 0x0F) == 0x0F)
{
fast_index->opLeft = fast_index->bkLeft;
fast_index->opTop = fast_index->bkTop;
uint8 flags = (uint8) (fast_index->opTop & 0x0F);
if (flags & 0x01)
fast_index->opBottom = fast_index->bkBottom;
if (flags & 0x02)
fast_index->opRight = fast_index->bkRight;
fast_index->opBottom = fast_index->bkBottom;
fast_index->opaqueRect = True;
}
else if ((fast_index->opTop & 0x0F) == 0x0D)
{
fast_index->opLeft = fast_index->bkLeft;
if (flags & 0x04)
fast_index->opTop = fast_index->bkTop;
fast_index->opBottom = fast_index->bkBottom;
fast_index->opaqueRect = True;
}
if (flags & 0x08)
fast_index->opLeft = fast_index->bkLeft;
}
if (fast_index->opRight - fast_index->opLeft > 1)
fast_index->opaqueRect = True;
if (fast_index->opLeft == 0)
fast_index->opLeft = fast_index->bkLeft;
if (fast_index->opRight == 0)
fast_index->opRight = fast_index->bkRight;
if (fast_index->x == -32768)
fast_index->x = fast_index->bkLeft;
@ -1182,6 +1174,9 @@ void update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_O
if (fast_index->y == -32768)
fast_index->y = fast_index->bkTop;
if ((fast_index->opRight > fast_index->opLeft) && (fast_index->opBottom > fast_index->opTop))
fast_index->opaqueRect = True;
if (orderInfo->fieldFlags & ORDER_FIELD_15)
{
uint8* mark;

View File

@ -677,7 +677,10 @@ void gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
{
int i, j;
int x, y;
uint32 color;
GDI_RECT rect;
uint32 bgcolor;
uint32 fgcolor;
HGDI_BRUSH brush;
GDI_IMAGE* bmp;
GDI_IMAGE** bmps;
GLYPH_DATA* glyph;
@ -688,9 +691,17 @@ void gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
x = fast_index->bkLeft;
y = fast_index->y;
color = freerdp_color_convert(fast_index->backColor, gdi->srcBpp, 32, gdi->clrconv);
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, color);
bgcolor = freerdp_color_convert(fast_index->backColor, gdi->srcBpp, 32, gdi->clrconv);
fgcolor = freerdp_color_convert(fast_index->foreColor, gdi->srcBpp, 32, gdi->clrconv);
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
gdi_SetNullClipRgn(gdi->drawing->hdc);
brush = gdi_CreateSolidBrush(fgcolor);
if (fast_index->opaqueRect)
{
gdi_SetRect(&rect, fast_index->opLeft, fast_index->opTop, fast_index->opRight, fast_index->opBottom);
gdi_FillRect(gdi->drawing->hdc, &rect, brush);
}
for (i = 0; i < fast_index->nfragments; i++)
{
@ -758,6 +769,7 @@ void gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
}
gdi_SetTextColor(gdi->drawing->hdc, gdi->textColor);
gdi_DeleteObject((HGDIOBJECT) brush);
}
void gdi_create_offscreen_bitmap(rdpUpdate* update, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)