--- sourceforge.net/trunk/rdesktop/orders.c 2005/03/08 00:43:10 831 +++ sourceforge.net/trunk/rdesktop/orders.c 2005/04/03 18:08:05 879 @@ -648,11 +648,10 @@ 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,36 @@ return; } - opcode = os->opcode - 1; - x = os->x; - y = os->y; + 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; pen.style = pen.width = 0; pen.colour = os->fgcolour; 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 & 0x40) - x += parse_delta(os->data, &data); - - if (flags & 0x80) - y += parse_delta(os->data, &data); + if (~flags & 0x80) + points[next].x = 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"); + + xfree(points); } /* Process an ellipse order */ @@ -805,7 +805,7 @@ in_uint8(s, os->flags); if (present & 0x000004) - in_uint8(s, os->unknown); + in_uint8(s, os->opcode); if (present & 0x000008) in_uint8(s, os->mixmode); @@ -840,27 +840,7 @@ if (present & 0x002000) in_uint16_le(s, os->boxbottom); - /* - * Unknown members, seen when connecting to a session that was disconnected with - * mstsc and with wintach's spreadsheet test. - */ - if (present & 0x004000) - in_uint8s(s, 1); - - if (present & 0x008000) - in_uint8s(s, 1); - - if (present & 0x010000) - { - in_uint8s(s, 1); /* guessing the length here */ - warning("Unknown order state member (0x010000) in text2 order.\n"); - } - - if (present & 0x020000) - in_uint8s(s, 4); - - if (present & 0x040000) - in_uint8s(s, 4); + rdp_parse_brush(s, &os->brush, present >> 14); if (present & 0x080000) in_uint16_le(s, os->x); @@ -874,7 +854,7 @@ in_uint8a(s, os->text, os->length); } - DEBUG(("TEXT2(x=%d,y=%d,cl=%d,ct=%d,cr=%d,cb=%d,bl=%d,bt=%d,bb=%d,br=%d,fg=0x%x,bg=0x%x,font=%d,fl=0x%x,mix=%d,unk=0x%x,n=%d)\n", os->x, os->y, os->clipleft, os->cliptop, os->clipright, os->clipbottom, os->boxleft, os->boxtop, os->boxright, os->boxbottom, os->fgcolour, os->bgcolour, os->font, os->flags, os->mixmode, os->unknown, os->length)); + DEBUG(("TEXT2(x=%d,y=%d,cl=%d,ct=%d,cr=%d,cb=%d,bl=%d,bt=%d,br=%d,bb=%d,bs=%d,bg=0x%x,fg=0x%x,font=%d,fl=0x%x,op=0x%x,mix=%d,n=%d)\n", os->x, os->y, os->clipleft, os->cliptop, os->clipright, os->clipbottom, os->boxleft, os->boxtop, os->boxright, os->boxbottom, os->brush.style, os->bgcolour, os->fgcolour, os->font, os->flags, os->opcode, os->mixmode, os->length)); DEBUG(("Text: ")); @@ -883,13 +863,11 @@ DEBUG(("\n")); - ui_draw_text(os->font, os->flags, os->mixmode, os->x, os->y, - os->clipleft, os->cliptop, - os->clipright - os->clipleft, - os->clipbottom - os->cliptop, - os->boxleft, os->boxtop, - os->boxright - os->boxleft, - os->boxbottom - os->boxtop, os->bgcolour, os->fgcolour, os->text, os->length); + ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y, + os->clipleft, os->cliptop, os->clipright - os->clipleft, + os->clipbottom - os->cliptop, os->boxleft, os->boxtop, + os->boxright - os->boxleft, os->boxbottom - os->boxtop, + &os->brush, os->bgcolour, os->fgcolour, os->text, os->length); } /* Process a raw bitmap cache order */