Fixed glyph cache bounds setting.

This commit is contained in:
Armin Novak 2018-11-19 13:58:53 +01:00
parent e94ed7d762
commit 75d532f87c
4 changed files with 57 additions and 25 deletions

View File

@ -126,6 +126,8 @@ typedef BOOL (*pGlyph_BeginDraw)(rdpContext* context, INT32 x, INT32 y,
UINT32 fgcolor, BOOL fOpRedundant);
typedef BOOL (*pGlyph_EndDraw)(rdpContext* context, INT32 x, INT32 y,
INT32 width, INT32 height, UINT32 bgcolor, UINT32 fgcolor);
typedef BOOL (*pGlyph_SetBounds)(rdpContext* context, INT32 x, INT32 y,
INT32 width, INT32 height);
struct rdp_glyph
{
@ -135,7 +137,8 @@ struct rdp_glyph
pGlyph_Draw Draw; /* 3 */
pGlyph_BeginDraw BeginDraw; /* 4 */
pGlyph_EndDraw EndDraw; /* 5 */
UINT32 paddingA[16 - 6]; /* 6 */
pGlyph_SetBounds SetBounds; /* 6 */
UINT32 paddingA[16 - 7]; /* 7 */
INT32 x; /* 16 */
INT32 y; /* 17 */

View File

@ -235,6 +235,9 @@ static BOOL update_process_glyph_fragments(rdpContext* context,
fOpRedundant))
return FALSE;
if (!IFCALLRESULT(TRUE, glyph->SetBounds, context, bkX, bkY, bkWidth, bkHeight))
return FALSE;
while (index < length)
{
const UINT32 op = data[index++];

View File

@ -583,6 +583,10 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, INT32 nXDest, INT32 nYDest,
if (!hdcDest)
return FALSE;
if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc,
&nYSrc))
return TRUE;
/* Check which ROP should be performed.
* Some specific ROP are used heavily and are resource intensive,
* add optimized versions for these here.

View File

@ -325,6 +325,21 @@ static BOOL gdi_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, INT32 x,
return rc;
}
static BOOL gdi_Glyph_SetBounds(rdpContext* context, INT32 x, INT32 y, INT32 width, INT32 height)
{
rdpGdi* gdi;
if (!context || !context->gdi)
return FALSE;
gdi = context->gdi;
if (!gdi->drawing || !gdi->drawing->hdc)
return FALSE;
return gdi_SetClipRgn(gdi->drawing->hdc, x, y, width, height);
}
static BOOL gdi_Glyph_BeginDraw(rdpContext* context, INT32 x, INT32 y,
INT32 width, INT32 height, UINT32 bgcolor,
UINT32 fgcolor, BOOL fOpRedundant)
@ -339,39 +354,45 @@ static BOOL gdi_Glyph_BeginDraw(rdpContext* context, INT32 x, INT32 y,
if (!gdi->drawing || !gdi->drawing->hdc)
return FALSE;
if (!gdi_decode_color(gdi, bgcolor, &bgcolor, NULL))
return FALSE;
if (!gdi_decode_color(gdi, fgcolor, &fgcolor, NULL))
return FALSE;
gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
gdi_SetBkColor(gdi->drawing->hdc, fgcolor);
if (1)
if (!fOpRedundant)
{
GDI_RECT rect = { 0 };
HGDI_BRUSH brush = gdi_CreateSolidBrush(fgcolor);
if (!brush)
if (!gdi_decode_color(gdi, bgcolor, &bgcolor, NULL))
return FALSE;
if (x > 0)
rect.left = x;
if (!gdi_decode_color(gdi, fgcolor, &fgcolor, NULL))
return FALSE;
if (y > 0)
rect.top = y;
gdi_SetClipRgn(gdi->drawing->hdc, x, y, width, height);
gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
gdi_SetBkColor(gdi->drawing->hdc, fgcolor);
rect.right = x + width - 1;
rect.bottom = y + height - 1;
if (1)
{
GDI_RECT rect = { 0 };
HGDI_BRUSH brush = gdi_CreateSolidBrush(fgcolor);
if ((x + width > rect.left) && (y + height > rect.top))
gdi_FillRect(gdi->drawing->hdc, &rect, brush);
if (!brush)
return FALSE;
gdi_DeleteObject((HGDIOBJECT)brush);
if (x > 0)
rect.left = x;
if (y > 0)
rect.top = y;
rect.right = x + width - 1;
rect.bottom = y + height - 1;
if ((x + width > rect.left) && (y + height > rect.top))
gdi_FillRect(gdi->drawing->hdc, &rect, brush);
gdi_DeleteObject((HGDIOBJECT)brush);
}
return gdi_SetNullClipRgn(gdi->drawing->hdc);
}
return gdi_SetClipRgn(gdi->drawing->hdc, x, y, width, height);
return TRUE;
}
static BOOL gdi_Glyph_EndDraw(rdpContext* context, INT32 x, INT32 y,
@ -409,6 +430,7 @@ BOOL gdi_register_graphics(rdpGraphics* graphics)
glyph.Draw = gdi_Glyph_Draw;
glyph.BeginDraw = gdi_Glyph_BeginDraw;
glyph.EndDraw = gdi_Glyph_EndDraw;
glyph.SetBounds = gdi_Glyph_SetBounds;
graphics_register_glyph(graphics, &glyph);
return TRUE;
}