fix polyline.
This commit is contained in:
parent
cda93be7dd
commit
3de5c62bf3
@ -608,8 +608,6 @@ void wf_gdi_line_to(wfContext* wfc, LINE_TO_ORDER* line_to)
|
|||||||
|
|
||||||
void wf_gdi_polyline(wfContext* wfc, POLYLINE_ORDER* polyline)
|
void wf_gdi_polyline(wfContext* wfc, POLYLINE_ORDER* polyline)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
POINT* pts;
|
|
||||||
int org_rop2;
|
int org_rop2;
|
||||||
HPEN hpen;
|
HPEN hpen;
|
||||||
HPEN org_hpen;
|
HPEN org_hpen;
|
||||||
@ -621,26 +619,28 @@ void wf_gdi_polyline(wfContext* wfc, POLYLINE_ORDER* polyline)
|
|||||||
org_rop2 = wf_set_rop2(wfc->drawing->hdc, polyline->bRop2);
|
org_rop2 = wf_set_rop2(wfc->drawing->hdc, polyline->bRop2);
|
||||||
org_hpen = (HPEN) SelectObject(wfc->drawing->hdc, hpen);
|
org_hpen = (HPEN) SelectObject(wfc->drawing->hdc, hpen);
|
||||||
|
|
||||||
if (polyline->numPoints > 0)
|
if (polyline->numDeltaEntries > 0)
|
||||||
{
|
{
|
||||||
POINT temp;
|
POINT *pts;
|
||||||
|
POINT temp;
|
||||||
|
int numPoints;
|
||||||
|
int i;
|
||||||
|
|
||||||
temp.x = polyline->xStart;
|
numPoints = polyline->numDeltaEntries + 1;
|
||||||
temp.y = polyline->yStart;
|
pts = (POINT*) malloc(sizeof(POINT) * numPoints);
|
||||||
pts = (POINT*) malloc(sizeof(POINT) * polyline->numPoints);
|
pts[0].x = temp.x = polyline->xStart;
|
||||||
|
pts[0].y = temp.y = polyline->yStart;
|
||||||
|
|
||||||
for (i = 0; i < (int) polyline->numPoints; i++)
|
for (i = 0; i < (int) polyline->numDeltaEntries; i++)
|
||||||
{
|
{
|
||||||
temp.x += polyline->points[i].x;
|
temp.x += polyline->points[i].x;
|
||||||
temp.y += polyline->points[i].y;
|
temp.y += polyline->points[i].y;
|
||||||
pts[i].x = temp.x;
|
pts[i + 1].x = temp.x;
|
||||||
pts[i].y = temp.y;
|
pts[i + 1].y = temp.y;
|
||||||
|
|
||||||
if (wfc->drawing == wfc->primary)
|
|
||||||
wf_invalidate_region(wfc, pts[i].x, pts[i].y, pts[i].x + 1, pts[i].y + 1);
|
|
||||||
}
|
}
|
||||||
|
if (wfc->drawing == wfc->primary)
|
||||||
Polyline(wfc->drawing->hdc, pts, polyline->numPoints);
|
wf_invalidate_region(wfc, wfc->client_x, wfc->client_y, wfc->client_width, wfc->client_height);
|
||||||
|
Polyline(wfc->drawing->hdc, pts, numPoints);
|
||||||
free(pts);
|
free(pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,6 +730,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
|||||||
int npoints;
|
int npoints;
|
||||||
UINT32 color;
|
UINT32 color;
|
||||||
XPoint* points;
|
XPoint* points;
|
||||||
|
XPoint tmp;
|
||||||
int width, height;
|
int width, height;
|
||||||
xfContext* xfc = (xfContext*) context;
|
xfContext* xfc = (xfContext*) context;
|
||||||
|
|
||||||
@ -742,16 +743,18 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
|||||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||||
XSetForeground(xfc->display, xfc->gc, color);
|
XSetForeground(xfc->display, xfc->gc, color);
|
||||||
|
|
||||||
npoints = polyline->numPoints + 1;
|
npoints = polyline->numDeltaEntries + 1;
|
||||||
points = malloc(sizeof(XPoint) * npoints);
|
points = malloc(sizeof(XPoint) * npoints);
|
||||||
|
|
||||||
points[0].x = polyline->xStart;
|
points[0].x = tmp.x = polyline->xStart;
|
||||||
points[0].y = polyline->yStart;
|
points[0].y = tmp.y = polyline->yStart;
|
||||||
|
|
||||||
for (i = 0; i < polyline->numPoints; i++)
|
for (i = 0; i < polyline->numDeltaEntries; i++)
|
||||||
{
|
{
|
||||||
points[i + 1].x = polyline->points[i].x;
|
tmp.x += polyline->points[i].x;
|
||||||
points[i + 1].y = polyline->points[i].y;
|
tmp.y += polyline->points[i].y;
|
||||||
|
points[i + 1].x = tmp.x;
|
||||||
|
points[i + 1].y = tmp.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
XDrawLines(xfc->display, xfc->drawing, xfc->gc, points, npoints, CoordModePrevious);
|
XDrawLines(xfc->display, xfc->drawing, xfc->gc, points, npoints, CoordModePrevious);
|
||||||
|
@ -244,7 +244,7 @@ struct _POLYLINE_ORDER
|
|||||||
INT32 yStart;
|
INT32 yStart;
|
||||||
UINT32 bRop2;
|
UINT32 bRop2;
|
||||||
UINT32 penColor;
|
UINT32 penColor;
|
||||||
UINT32 numPoints;
|
UINT32 numDeltaEntries;
|
||||||
UINT32 cbData;
|
UINT32 cbData;
|
||||||
DELTA_POINT* points;
|
DELTA_POINT* points;
|
||||||
};
|
};
|
||||||
|
@ -343,8 +343,8 @@ static void update_message_Polyline(rdpContext* context, POLYLINE_ORDER* polylin
|
|||||||
wParam = (POLYLINE_ORDER*) malloc(sizeof(POLYLINE_ORDER));
|
wParam = (POLYLINE_ORDER*) malloc(sizeof(POLYLINE_ORDER));
|
||||||
CopyMemory(wParam, polyline, sizeof(POLYLINE_ORDER));
|
CopyMemory(wParam, polyline, sizeof(POLYLINE_ORDER));
|
||||||
|
|
||||||
wParam->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * wParam->numPoints);
|
wParam->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * wParam->numDeltaEntries);
|
||||||
CopyMemory(wParam->points, polyline->points, sizeof(DELTA_POINT) * wParam->numPoints);
|
CopyMemory(wParam->points, polyline->points, sizeof(DELTA_POINT) * wParam->numDeltaEntries);
|
||||||
|
|
||||||
MessageQueue_Post(context->update->queue, (void*) context,
|
MessageQueue_Post(context->update->queue, (void*) context,
|
||||||
MakeMessageId(PrimaryUpdate, Polyline), (void*) wParam, NULL);
|
MakeMessageId(PrimaryUpdate, Polyline), (void*) wParam, NULL);
|
||||||
|
@ -1320,7 +1320,7 @@ BOOL update_read_polyline_order(wStream* s, ORDER_INFO* orderInfo, POLYLINE_ORDE
|
|||||||
ORDER_FIELD_BYTE(3, polyline->bRop2);
|
ORDER_FIELD_BYTE(3, polyline->bRop2);
|
||||||
ORDER_FIELD_UINT16(4, word);
|
ORDER_FIELD_UINT16(4, word);
|
||||||
ORDER_FIELD_COLOR(5, polyline->penColor);
|
ORDER_FIELD_COLOR(5, polyline->penColor);
|
||||||
ORDER_FIELD_BYTE(6, polyline->numPoints);
|
ORDER_FIELD_BYTE(6, polyline->numDeltaEntries);
|
||||||
|
|
||||||
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
||||||
{
|
{
|
||||||
@ -1329,11 +1329,11 @@ BOOL update_read_polyline_order(wStream* s, ORDER_INFO* orderInfo, POLYLINE_ORDE
|
|||||||
Stream_Read_UINT8(s, polyline->cbData);
|
Stream_Read_UINT8(s, polyline->cbData);
|
||||||
|
|
||||||
if (polyline->points == NULL)
|
if (polyline->points == NULL)
|
||||||
polyline->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polyline->numPoints);
|
polyline->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polyline->numDeltaEntries);
|
||||||
else
|
else
|
||||||
polyline->points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * polyline->numPoints);
|
polyline->points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * polyline->numDeltaEntries);
|
||||||
|
|
||||||
return update_read_delta_points(s, polyline->points, polyline->numPoints, polyline->xStart, polyline->yStart);
|
return update_read_delta_points(s, polyline->points, polyline->numDeltaEntries, polyline->xStart, polyline->yStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -753,7 +753,7 @@ static void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
|||||||
gdi_MoveToEx(gdi->drawing->hdc, x, y, NULL);
|
gdi_MoveToEx(gdi->drawing->hdc, x, y, NULL);
|
||||||
|
|
||||||
points = polyline->points;
|
points = polyline->points;
|
||||||
for (i = 0; i < (int) polyline->numPoints; i++)
|
for (i = 0; i < (int) polyline->numDeltaEntries; i++)
|
||||||
{
|
{
|
||||||
x += points[i].x;
|
x += points[i].x;
|
||||||
y += points[i].y;
|
y += points[i].y;
|
||||||
|
Loading…
Reference in New Issue
Block a user