return ret;
}
-static BOOL xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points, int npoints, BOOL autoclose)
+static BOOL xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points, int npoints)
{
- int i, x, y, x1, y1, x2, y2, w, h;
+ int x, y, x1, y1, x2, y2;
- x1 = points[0].x;
- y1 = points[0].y;
-
- for (i = 1; i <= npoints; i++)
- {
- if (i == npoints)
- {
- if (!autoclose)
- break;
-
- x2 = points[0].x;
- y2 = points[0].y;
-
- if (x2 == points[0].x && y2 == points[0].y)
- break;
- }
- else
- {
- x2 = points[i].x + x1;
- y2 = points[i].y + y1;
- }
+ if (npoints < 2)
+ return FALSE;
- x = MIN(x1, x2);
- y = MIN(y1, y2);
+ x = x1 = x2 = points->x;
+ y = y1 = y2 = points->y;
- w = abs(x2 - x1) + 1;
- h = abs(y2 - y1) + 1;
+ while (--npoints)
+ {
+ points++;
+ x += points->x;
+ y += points->y;
+
+ if (x > x2)
+ x2 = x;
+ if (x < x1)
+ x1 = x;
+ if (y > y2)
+ y2 = y;
+ if (y < y1)
+ y1 = y;
+ }
- x1 = x2;
- y1 = y2;
+ x2++;
+ y2++;
- if (!gdi_InvalidateRegion(xfc->hdc, x, y, w, h))
- return FALSE;
- }
- return TRUE;
+ return gdi_InvalidateRegion(xfc->hdc, x1, y1, x2 - x1, y2 - y1);
}
BOOL xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
if (xfc->drawing == xfc->primary)
{
- if (!xf_gdi_invalidate_poly_region(xfc, points, npoints, FALSE))
+ if (!xf_gdi_invalidate_poly_region(xfc, points, npoints))
ret = FALSE;
}
return ret;
}
+
BOOL xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
{
int i, npoints;
if (xfc->drawing == xfc->primary)
{
- if (!xf_gdi_invalidate_poly_region(xfc, points, npoints, TRUE))
+ if (!xf_gdi_invalidate_poly_region(xfc, points, npoints))
ret = FALSE;
}
if (xfc->drawing == xfc->primary)
{
- if (!xf_gdi_invalidate_poly_region(xfc, points, npoints, TRUE))
+ if (!xf_gdi_invalidate_poly_region(xfc, points, npoints))
ret = FALSE;
}
}