do polyline in a single ui operation: ui_polyline
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@843 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
8bc5e0ad3f
commit
0b5bb3b442
40
orders.c
40
orders.c
@ -648,11 +648,10 @@ process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta)
|
||||
static void
|
||||
process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta)
|
||||
{
|
||||
int index, line, data;
|
||||
int x, y, xfrom, yfrom;
|
||||
int index, next, data;
|
||||
uint8 flags = 0;
|
||||
PEN pen;
|
||||
uint8 opcode;
|
||||
POINT *points;
|
||||
|
||||
if (present & 0x01)
|
||||
rdp_in_coord(s, &os->x, delta);
|
||||
@ -691,35 +690,32 @@ process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta)
|
||||
return;
|
||||
}
|
||||
|
||||
opcode = os->opcode - 1;
|
||||
x = os->x;
|
||||
y = os->y;
|
||||
pen.style = pen.width = 0;
|
||||
pen.colour = os->fgcolour;
|
||||
points = (POINT *) xmalloc((os->lines + 1) * sizeof(POINT));
|
||||
memset(points, 0, (os->lines + 1) * sizeof(POINT));
|
||||
|
||||
points[0].x = os->x;
|
||||
points[0].y = os->y;
|
||||
|
||||
index = 0;
|
||||
data = ((os->lines - 1) / 4) + 1;
|
||||
for (line = 0; (line < os->lines) && (data < os->datasize); line++)
|
||||
for (next = 1; (next < os->lines) && (data < os->datasize); next++)
|
||||
{
|
||||
xfrom = x;
|
||||
yfrom = y;
|
||||
|
||||
if (line % 4 == 0)
|
||||
if ((next - 1) % 4 == 0)
|
||||
flags = os->data[index++];
|
||||
|
||||
if ((flags & 0xc0) == 0)
|
||||
flags |= 0xc0; /* none = both */
|
||||
if (~flags & 0x80)
|
||||
points[next].x = parse_delta(os->data, &data);
|
||||
|
||||
if (flags & 0x40)
|
||||
x += parse_delta(os->data, &data);
|
||||
|
||||
if (flags & 0x80)
|
||||
y += parse_delta(os->data, &data);
|
||||
|
||||
ui_line(opcode, xfrom, yfrom, x, y, &pen);
|
||||
if (~flags & 0x40)
|
||||
points[next].y = parse_delta(os->data, &data);
|
||||
|
||||
flags <<= 2;
|
||||
}
|
||||
|
||||
if (next - 1 == os->lines)
|
||||
ui_polyline(os->opcode - 1, points, os->lines + 1, &pen);
|
||||
else
|
||||
error("polyline parse error\n");
|
||||
}
|
||||
|
||||
/* Process an ellipse order */
|
||||
|
1
proto.h
1
proto.h
@ -213,6 +213,7 @@ void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN * pen
|
||||
void ui_rect(int x, int y, int cx, int cy, int colour);
|
||||
void ui_polygon(uint8 opcode, uint8 fillmode, POINT * point, int npoints, BRUSH * brush,
|
||||
int bgcolour, int fgcolour);
|
||||
void ui_polyline(uint8 opcode, POINT * point, int npoints, PEN * pen);
|
||||
void ui_ellipse(uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH * brush,
|
||||
int bgcolour, int fgcolour);
|
||||
void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, HGLYPH glyph, int srcx, int srcy,
|
||||
|
15
xwin.c
15
xwin.c
@ -2262,6 +2262,21 @@ ui_polygon(uint8 opcode,
|
||||
RESET_FUNCTION(opcode);
|
||||
}
|
||||
|
||||
void
|
||||
ui_polyline(uint8 opcode,
|
||||
/* dest */ POINT * points, int npoints,
|
||||
/* pen */ PEN * pen)
|
||||
{
|
||||
/* TODO: set join style */
|
||||
SET_FUNCTION(opcode);
|
||||
SET_FOREGROUND(pen->colour);
|
||||
XDrawLines(g_display, g_wnd, g_gc, (XPoint *) points, npoints, CoordModePrevious);
|
||||
if (g_ownbackstore)
|
||||
XDrawLines(g_display, g_backstore, g_gc, (XPoint *) points, npoints,
|
||||
CoordModePrevious);
|
||||
RESET_FUNCTION(opcode);
|
||||
}
|
||||
|
||||
void
|
||||
ui_ellipse(uint8 opcode,
|
||||
/* mode */ uint8 fillmode,
|
||||
|
Loading…
Reference in New Issue
Block a user