Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Diff by mister ( 10 years ago )
diff -Naur ./FreeRDP-1.0.2/client/DirectFB/dfreerdp.c ./FreeRDP-1.0.2x/client/DirectFB/dfreerdp.c
--- ./FreeRDP-1.0.2/client/DirectFB/dfreerdp.c Thu Jan 3 00:46:59 2013
+++ ./FreeRDP-1.0.2x/client/DirectFB/dfreerdp.c Tue Sep 23 09:29:00 2014
@@ -54,12 +54,131 @@
{
rdpGdi* gdi = context->gdi;
gdi->primary->hdc->hwnd->invalid->null = 1;
+ gdi->primary->hdc->hwnd->ninvalid = 0;
+}
+
+int reduce_invalid_regions(int ninvalid, GDI_RGN *cinvalid)
+{
+ int i, j, tmp;
+ char c;
+ GDI_RGN *ci, *cj;
+ for (;;)
+ {
+ for (i = 0; i<ninvalid;)
+ {
+ ci = &cinvalid;[i];
+ for (j = i+1; j<ninvalid; ++j)
+ {
+ cj = &cinvalid;[j];
+ if (ci->h==cj->h && ci->y==cj->y)
+ {
+ if (ci->x <= cj->x && ci->x + ci->w >= cj->x)
+ {//[i] horizontally combines or consumes [j]
+ tmp = cj->x + cj->w - ci->x;
+ if (ci->w < tmp)
+ ci->w = tmp;
+ break;
+ }
+
+ if (cj->x <= ci->x && cj->x + cj->w >= ci->x)
+ {//[j] horizontally combines or consumes [i]
+ tmp = ci->x + ci->w - cj->x;
+ ci->w = (cj->w < tmp) ? tmp : cj->w;
+ ci->x = cj->x;
+ break;
+ }
+ }
+ }
+ if (j < ninvalid)
+ {
+ --ninvalid;
+ memmove(cj, cj + 1, (ninvalid - j) * sizeof(*cj));
+ }
+ else
+ ++i;
+ }
+
+ c = 0;
+ for (i = 0; i<ninvalid;)
+ {
+ ci = &cinvalid;[i];
+ for (j = i+1; j<ninvalid; ++j)
+ {
+ cj = &cinvalid;[j];
+ if (ci->w==cj->w && ci->x==cj->x)
+ {
+ if (ci->y <= cj->y && ci->y + ci->h >= cj->y)
+ {//[i] vertically combines or consumes [j]
+ tmp = cj->y + cj->h - ci->y;
+ if (ci->h < tmp)
+ ci->h = tmp;
+ break;
+ }
+
+ if (cj->y <= ci->y && cj->y + cj->h >= ci->y)
+ {//[j] vertically combines or consumes [i]
+ tmp = ci->y + ci->h - cj->y;
+ ci->h = (cj->h < tmp) ? tmp : cj->h;
+ ci->y = cj->y;
+ break;
+ }
+ }
+ }
+ if (j < ninvalid)
+ {
+ --ninvalid;
+ c = 1;
+ memmove(cj, cj + 1, (ninvalid - j) * sizeof(*cj));
+ }
+ else
+ ++i;
+ }
+ if (!c) break;
+ }
+
+
+ for (i = 0; i<ninvalid;)
+ {
+ ci = &cinvalid;[i];
+ for (j = i+1; j<ninvalid; ++j)
+ {
+ cj = &cinvalid;[j];
+ if (ci->x<=cj->x && ci->y<=cj->y &&
+ ci->x + ci->w>=cj->x + cj->w &&
+ ci->y + ci->h>=cj->y + cj->h)
+ { //[i] consumes [j]
+ break;
+ }
+
+ if (cj->x<=ci->x && cj->y<=ci->y &&
+ cj->x + cj->w>=ci->x + ci->w &&
+ cj->y + cj->h>=ci->y + ci->h)
+ { //[j] consumes [i]
+ memcpy(ci, cj, sizeof(*ci));
+ break;
+ }
+ }
+ if (j < ninvalid)
+ {
+ --ninvalid;
+ memmove(cj, cj + 1, (ninvalid - j) * sizeof(*cj));
+ }
+ else
+ ++i;
+ }
+
+
+ //todo: reduce other possible intersections
+
+ return ninvalid;
}
void df_end_paint(rdpContext* context)
{
rdpGdi* gdi;
dfInfo* dfi;
+ int ninvalid;
+ HGDI_RGN cinvalid;
gdi = context->gdi;
dfi = ((dfContext*) context)->dfi;
@@ -67,19 +186,21 @@
if (gdi->primary->hdc->hwnd->invalid->null)
return;
-#if 1
- dfi->update_rect.x = gdi->primary->hdc->hwnd->invalid->x;
- dfi->update_rect.y = gdi->primary->hdc->hwnd->invalid->y;
- dfi->update_rect.w = gdi->primary->hdc->hwnd->invalid->w;
- dfi->update_rect.h = gdi->primary->hdc->hwnd->invalid->h;
-#else
- dfi->update_rect.x = 0;
- dfi->update_rect.y = 0;
- dfi->update_rect.w = gdi->width;
- dfi->update_rect.h = gdi->height;
-#endif
+ cinvalid = gdi->primary->hdc->hwnd->cinvalid;
+ ninvalid = gdi->primary->hdc->hwnd->ninvalid;
+ if (ninvalid>1)
+ {
+ gdi->primary->hdc->hwnd->ninvalid = ninvalid = reduce_invalid_regions(ninvalid, cinvalid);
+ }
- dfi->primary->Blit(dfi->primary, dfi->surface, &(dfi->update_rect), dfi->update_rect.x, dfi->update_rect.y);
+ for (; ninvalid>0; --ninvalid, ++cinvalid)
+ {
+ dfi->update_rect.x = cinvalid->x;
+ dfi->update_rect.y = cinvalid->y;
+ dfi->update_rect.w = cinvalid->w;
+ dfi->update_rect.h = cinvalid->h;
+ dfi->primary->Blit(dfi->primary, dfi->surface, &(dfi->update_rect), dfi->update_rect.x, dfi->update_rect.y);
+ }
}
boolean df_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount)
diff -Naur ./FreeRDP-1.0.2/libfreerdp-gdi/gdi.c ./FreeRDP-1.0.2x/libfreerdp-gdi/gdi.c
--- ./FreeRDP-1.0.2/libfreerdp-gdi/gdi.c Thu Jan 3 00:46:59 2013
+++ ./FreeRDP-1.0.2x/libfreerdp-gdi/gdi.c Tue Sep 23 10:42:00 2014
@@ -533,7 +533,7 @@
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight, ▭);
- brush_color = freerdp_color_convert_var_bgr(opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
+ brush_color = freerdp_color_convert_var_rgb(opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
hBrush = gdi_CreateSolidBrush(brush_color);
gdi_FillRect(gdi->drawing->hdc, ▭, hBrush);
@@ -557,7 +557,7 @@
gdi_CRgnToRect(rectangle->left, rectangle->top,
rectangle->width, rectangle->height, ▭);
- brush_color = freerdp_color_convert_var_bgr(multi_opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
+ brush_color = freerdp_color_convert_var_rgb(multi_opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
hBrush = gdi_CreateSolidBrush(brush_color);
gdi_FillRect(gdi->drawing->hdc, ▭, hBrush);
Revise this Paste