libfreerdp-core/orders: fix polyline segfault.

This commit is contained in:
Vic Lee 2011-09-10 19:32:09 +08:00
parent ee2dc5449f
commit 4da24ec6a7
2 changed files with 8 additions and 12 deletions

View File

@ -405,10 +405,10 @@ INLINE void update_read_delta_points(STREAM* s, DELTA_POINT* points, int number,
memset(points, 0, sizeof(DELTA_POINT) * number);
for (i = 1; i < number + 1; i++)
for (i = 0; i < number; i++)
{
if ((i - 1) % 4 == 0)
flags = zeroBits[(i - 1) / 4];
if (i % 4 == 0)
flags = zeroBits[i / 4];
if (~flags & 0x80)
update_read_delta(s, &points[i].x);
@ -416,17 +416,11 @@ INLINE void update_read_delta_points(STREAM* s, DELTA_POINT* points, int number,
if (~flags & 0x40)
update_read_delta(s, &points[i].y);
points[i].x = points[i].x + points[i - 1].x;
points[i].y = points[i].y + points[i - 1].y;
points[i - 1].x += x;
points[i - 1].y += y;
points[i].x += (i > 0 ? points[i - 1].x : x);
points[i].y += (i > 0 ? points[i - 1].y : y);
flags <<= 2;
}
points[i - 1].x += x;
points[i - 1].y += y;
}
INLINE uint16 update_read_glyph_fragments(STREAM* s, GLYPH_FRAGMENT** fragments, boolean delta, uint8 size)

View File

@ -628,11 +628,13 @@ void gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
gdi_SetROP2(gdi->drawing->hdc, polyline->bRop2);
gdi_MoveToEx(gdi->drawing->hdc, polyline->xStart, polyline->yStart, NULL);
points = polyline->points;
for (i = 0; i < polyline->numPoints; i++)
{
gdi_LineTo(gdi->drawing->hdc, points[i].x, points[i].y);
gdi_MoveToEx(gdi->drawing->hdc, points[i].x, points[i].y, NULL);
gdi_LineTo(gdi->drawing->hdc, points[i + 1].x, points[i + 1].y);
}
gdi_DeleteObject((HGDIOBJECT) hPen);