Merge pull request #2178 from nfedera/fix-2014-10-29-01
xfreerdp: fix glyph index primary drawing order
This commit is contained in:
commit
4eedf207a9
@ -377,7 +377,7 @@ void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
|
||||
void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
|
||||
void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
@ -390,13 +390,18 @@ void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height
|
||||
bgcolor = xf_gdi_get_color(xfc, bgcolor);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, fgcolor);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, width, height);
|
||||
|
||||
if (width && height)
|
||||
{
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, fgcolor);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, width, height);
|
||||
}
|
||||
|
||||
XSetForeground(xfc->display, xfc->gc, bgcolor);
|
||||
XSetBackground(xfc->display, xfc->gc, fgcolor);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillStippled);
|
||||
|
||||
XSetFillStyle(xfc->display, xfc->gc, fOpRedundant ? FillOpaqueStippled : FillStippled);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ FREERDP_API void Pointer_SetDefault(rdpContext* context);
|
||||
typedef void (*pGlyph_New)(rdpContext* context, rdpGlyph* glyph);
|
||||
typedef void (*pGlyph_Free)(rdpContext* context, rdpGlyph* glyph);
|
||||
typedef void (*pGlyph_Draw)(rdpContext* context, rdpGlyph* glyph, int x, int y);
|
||||
typedef void (*pGlyph_BeginDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
|
||||
typedef void (*pGlyph_BeginDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant);
|
||||
typedef void (*pGlyph_EndDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
|
||||
|
||||
struct rdp_glyph
|
||||
@ -149,7 +149,7 @@ FREERDP_API rdpGlyph* Glyph_Alloc(rdpContext* context);
|
||||
FREERDP_API void Glyph_New(rdpContext* context, rdpGlyph* glyph);
|
||||
FREERDP_API void Glyph_Free(rdpContext* context, rdpGlyph* glyph);
|
||||
FREERDP_API void Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y);
|
||||
FREERDP_API void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
|
||||
FREERDP_API void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant);
|
||||
FREERDP_API void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
|
||||
|
||||
/* Graphics Module */
|
||||
|
37
libfreerdp/cache/glyph.c
vendored
37
libfreerdp/cache/glyph.c
vendored
@ -79,7 +79,7 @@ void update_process_glyph(rdpContext* context, BYTE* data, int* index,
|
||||
|
||||
void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 length,
|
||||
UINT32 cacheId, UINT32 ulCharInc, UINT32 flAccel, UINT32 bgcolor, UINT32 fgcolor, int x, int y,
|
||||
int bkX, int bkY, int bkWidth, int bkHeight, int opX, int opY, int opWidth, int opHeight)
|
||||
int bkX, int bkY, int bkWidth, int bkHeight, int opX, int opY, int opWidth, int opHeight, BOOL fOpRedundant)
|
||||
{
|
||||
int n;
|
||||
UINT32 id;
|
||||
@ -93,9 +93,9 @@ void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 leng
|
||||
glyph_cache = context->cache->glyph;
|
||||
|
||||
if (opWidth > 0 && opHeight > 0)
|
||||
Glyph_BeginDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor);
|
||||
Glyph_BeginDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor, fOpRedundant);
|
||||
else
|
||||
Glyph_BeginDraw(context, 0, 0, 0, 0, bgcolor, fgcolor);
|
||||
Glyph_BeginDraw(context, 0, 0, 0, 0, bgcolor, fgcolor, fOpRedundant);
|
||||
|
||||
while (index < (int) length)
|
||||
{
|
||||
@ -176,16 +176,33 @@ void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 leng
|
||||
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,
|
||||
glyphIndex->bkRight - glyphIndex->bkLeft, glyphIndex->bkBottom - glyphIndex->bkTop,
|
||||
glyphIndex->opLeft, glyphIndex->opTop,
|
||||
glyphIndex->opRight - glyphIndex->opLeft, glyphIndex->opBottom - glyphIndex->opTop);
|
||||
glyphIndex->bkLeft, glyphIndex->bkTop, bkWidth, bkHeight,
|
||||
glyphIndex->opLeft, glyphIndex->opTop, opWidth, opHeight,
|
||||
glyphIndex->fOpRedundant);
|
||||
}
|
||||
|
||||
void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fastIndex)
|
||||
@ -236,7 +253,8 @@ void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fastIndex)
|
||||
fastIndex->bkLeft, fastIndex->bkTop,
|
||||
fastIndex->bkRight - fastIndex->bkLeft, fastIndex->bkBottom - fastIndex->bkTop,
|
||||
opLeft, opTop,
|
||||
opRight - opLeft, opBottom - opTop);
|
||||
opRight - opLeft, opBottom - opTop,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph)
|
||||
@ -309,7 +327,8 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph)
|
||||
fastGlyph->bkLeft, fastGlyph->bkTop,
|
||||
fastGlyph->bkRight - fastGlyph->bkLeft, fastGlyph->bkBottom - fastGlyph->bkTop,
|
||||
opLeft, opTop,
|
||||
opRight - opLeft, opBottom - opTop);
|
||||
opRight - opLeft, opBottom - opTop,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyph)
|
||||
|
@ -186,9 +186,9 @@ void Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
|
||||
context->graphics->Glyph_Prototype->Draw(context, glyph, x, y);
|
||||
}
|
||||
|
||||
void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
|
||||
void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
|
||||
{
|
||||
context->graphics->Glyph_Prototype->BeginDraw(context, x, y, width, height, bgcolor, fgcolor);
|
||||
context->graphics->Glyph_Prototype->BeginDraw(context, x, y, width, height, bgcolor, fgcolor, fOpRedundant);
|
||||
}
|
||||
|
||||
void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
|
||||
|
@ -261,12 +261,14 @@ void gdi_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
|
||||
gdi_glyph->bitmap->height, gdi_glyph->hdc, 0, 0, GDI_DSPDxax);
|
||||
}
|
||||
|
||||
void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
|
||||
void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
|
||||
{
|
||||
GDI_RECT rect;
|
||||
HGDI_BRUSH brush;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
/* TODO: handle fOpRedundant! See xf_Glyph_BeginDraw() */
|
||||
|
||||
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
fgcolor = freerdp_convert_gdi_order_color(fgcolor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user