xfreerdp: optimize the updating of invalid regions on RAIL windows

This commit is contained in:
Marc-André Moreau 2011-08-19 12:43:44 -04:00
parent 9e42276d1b
commit 181154f01f
3 changed files with 34 additions and 11 deletions

View File

@ -23,10 +23,15 @@
#include "xf_rail.h" #include "xf_rail.h"
void xf_rail_paint(xfInfo* xfi, rdpRail* rail) void xf_rail_paint(xfInfo* xfi, rdpRail* rail, uint32 ileft, uint32 itop, uint32 iright, uint32 ibottom)
{ {
xfWindow* xfw; xfWindow* xfw;
rdpWindow* window; rdpWindow* window;
boolean intersect;
uint32 uwidth, uheight;
uint32 uleft, utop, uright, ubottom;
uint32 wleft, wtop, wright, wbottom;
window_list_rewind(rail->list); window_list_rewind(rail->list);
while (window_list_has_next(rail->list)) while (window_list_has_next(rail->list))
@ -34,17 +39,34 @@ void xf_rail_paint(xfInfo* xfi, rdpRail* rail)
window = window_list_get_next(rail->list); window = window_list_get_next(rail->list);
xfw = (xfWindow*) window->extra; xfw = (xfWindow*) window->extra;
XPutImage(xfi->display, xfi->primary, xfw->gc, xfi->image, wleft = window->windowOffsetX;
window->windowOffsetX, window->windowOffsetY, wtop = window->windowOffsetY;
window->windowOffsetX, window->windowOffsetY, wright = window->windowOffsetX + window->windowWidth - 1;
window->windowWidth, window->windowHeight); wbottom = window->windowOffsetY + window->windowHeight - 1;
XCopyArea(xfi->display, xfi->primary, xfw->handle, xfw->gc, intersect = ((iright > wleft) && (ileft < wright) &&
window->windowOffsetX, window->windowOffsetY, (ibottom > wtop) && (itop < wbottom)) ? True : False;
window->windowWidth, window->windowHeight, 0, 0);
XFlush(xfi->display); uleft = (ileft > wleft) ? ileft : wleft;
utop = (itop > wtop) ? itop : wtop;
uright = (iright < wright) ? iright : wright;
ubottom = (ibottom < wbottom) ? ibottom : wbottom;
uwidth = uright - uleft + 1;
uheight = ubottom - utop + 1;
if (intersect)
{
XPutImage(xfi->display, xfi->primary, xfw->gc, xfi->image,
uleft, utop, uleft, utop, uwidth, uheight);
XCopyArea(xfi->display, xfi->primary, xfw->handle, xfw->gc,
uleft, utop, uwidth, uheight,
uleft - window->windowOffsetX,
utop - window->windowOffsetY);
}
} }
XFlush(xfi->display);
} }
void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window) void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window)

View File

@ -22,7 +22,8 @@
#include "xfreerdp.h" #include "xfreerdp.h"
void xf_rail_paint(xfInfo* xfi, rdpRail* rail); void xf_rail_paint(xfInfo* xfi, rdpRail* rail, uint32 ileft, uint32 itop, uint32 iright, uint32 ibottom);
void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail); void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail);
void xf_process_rail_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event); void xf_process_rail_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event);

View File

@ -79,7 +79,7 @@ void xf_end_paint(rdpUpdate* update)
} }
else else
{ {
xf_rail_paint(xfi, update->rail); xf_rail_paint(xfi, update->rail, x, y, x + w - 1, y + h - 1);
} }
} }