libfreerdp-gdi: fix and re-introduce complex region support

This commit is contained in:
Marc-André Moreau 2011-08-26 13:37:23 -04:00
parent 62de97f72b
commit b0854dd817
6 changed files with 53 additions and 58 deletions

View File

@ -73,7 +73,8 @@ void xf_end_paint(rdpUpdate* update)
if (xfi->remote_app != True)
{
#if 1
if (xfi->complex_regions != True)
{
if (gdi->primary->hdc->hwnd->invalid->null)
return;
@ -84,10 +85,12 @@ void xf_end_paint(rdpUpdate* update)
XPutImage(xfi->display, xfi->primary, xfi->gc, xfi->image, x, y, x, y, w, h);
XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc, x, y, w, h, x, y);
#else
}
else
{
int i;
int ninvalid;
HGDI_RGN* cinvalid;
HGDI_RGN cinvalid;
if (gdi->primary->hdc->hwnd->ninvalid < 1)
return;
@ -97,17 +100,17 @@ void xf_end_paint(rdpUpdate* update)
for (i = 0; i < ninvalid; i++)
{
x = cinvalid[i]->x;
y = cinvalid[i]->y;
w = cinvalid[i]->w;
h = cinvalid[i]->h;
x = cinvalid[i].x;
y = cinvalid[i].y;
w = cinvalid[i].w;
h = cinvalid[i].h;
XPutImage(xfi->display, xfi->primary, xfi->gc, xfi->image, x, y, x, y, w, h);
XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc, x, y, w, h, x, y);
}
XFlush(xfi->display);
#endif
}
}
else
{
@ -300,6 +303,7 @@ boolean xf_pre_connect(freerdp* instance)
xfi->big_endian = (ImageByteOrder(xfi->display) == MSBFirst);
xfi->mouse_motion = False;
xfi->complex_regions = True;
xfi->decoration = settings->decorations;
xfi->remote_app = settings->remote_app;
xfi->fullscreen = settings->fullscreen;

View File

@ -81,6 +81,7 @@ struct xf_info
boolean pressed_keys[256];
XModifierKeymap* modifier_map;
XSetWindowAttributes attribs;
boolean complex_regions;
Atom _NET_WM_ICON;
Atom _MOTIF_WM_HINTS;

View File

@ -193,9 +193,10 @@ typedef GDI_BRUSH* HGDI_BRUSH;
struct _GDI_WND
{
int count;
int ninvalid;
HGDI_RGN invalid;
HGDI_RGN* cinvalid;
HGDI_RGN cinvalid;
};
typedef struct _GDI_WND GDI_WND;
typedef GDI_WND* HGDI_WND;
@ -216,7 +217,6 @@ struct _GDI_DC
int alpha;
int invert;
int rgb555;
int complex;
};
typedef struct _GDI_DC GDI_DC;
typedef GDI_DC* HGDI_DC;

View File

@ -77,8 +77,7 @@ void update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
dstSize = cbUncompressedSize;
bitmap_data->length = cbCompMainBodySize;
bitmap_data->data = (uint8*) xzalloc(dstSize);
bitmap_data->data = (uint8*) xmalloc(dstSize);
stream_get_mark(s, srcData);
stream_seek(s, bitmap_data->length);

View File

@ -308,7 +308,7 @@ inline uint32 gdi_rop3_code(uint8 code)
inline void gdi_copy_mem(uint8 * d, uint8 * s, int n)
{
memcpy(d, s, n);
memmove(d, s, n);
}
inline void gdi_copy_mem_backwards(uint8 * d, uint8 * s, int n)
@ -949,7 +949,6 @@ int gdi_init(freerdp* instance, uint32 flags)
gdi->hdc->alpha = gdi->clrconv->alpha;
gdi->hdc->invert = gdi->clrconv->invert;
gdi->hdc->rgb555 = gdi->clrconv->rgb555;
gdi->hdc->complex = 1;
gdi->primary = gdi_bitmap_new(gdi, gdi->width, gdi->height, gdi->dstBpp, NULL);
gdi->primary_buffer = gdi->primary->bitmap->data;
@ -958,7 +957,9 @@ int gdi_init(freerdp* instance, uint32 flags)
gdi->primary->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
gdi->primary->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->cinvalid = NULL;
gdi->primary->hdc->hwnd->count = 32;
gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * gdi->primary->hdc->hwnd->count);
gdi->primary->hdc->hwnd->ninvalid = 0;
gdi->tile = gdi_bitmap_new(gdi, 64, 64, 32, NULL);

View File

@ -374,34 +374,24 @@ inline int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
GDI_RECT inv;
GDI_RECT rgn;
HGDI_RGN invalid;
HGDI_RGN cinvalid;
if (hdc->hwnd == NULL)
return 0;
if (hdc->complex)
{
HGDI_RGN* cinvalid;
if (hdc->hwnd->invalid == NULL)
return 0;
cinvalid = hdc->hwnd->cinvalid;
if (hdc->hwnd->ninvalid <= 0)
if (hdc->hwnd->ninvalid + 1 > hdc->hwnd->count)
{
hdc->hwnd->ninvalid = 0;
cinvalid = (HGDI_RGN*) malloc(sizeof(HGDI_RGN));
}
else
{
cinvalid = (HGDI_RGN*) realloc(cinvalid, sizeof(HGDI_RGN) * (hdc->hwnd->ninvalid + 1));
hdc->hwnd->count *= 2;
cinvalid = (HGDI_RGN) realloc(cinvalid, sizeof(GDI_RGN) * (hdc->hwnd->count));
}
invalid = gdi_CreateRectRgn(x, y, x + w - 1, y + h - 1);
cinvalid[hdc->hwnd->ninvalid] = invalid;
gdi_SetRgn(&cinvalid[hdc->hwnd->ninvalid++], x, y, w, h);
hdc->hwnd->cinvalid = cinvalid;
hdc->hwnd->ninvalid++;
}
if (hdc->hwnd->invalid == NULL)
return 0;
invalid = hdc->hwnd->invalid;