Added polyline order (undocumented, id 22)

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@14 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Matt Chapman 2000-09-28 05:27:25 +00:00
parent d7b51f3e70
commit 23514dce50
2 changed files with 109 additions and 1 deletions

View File

@ -441,6 +441,93 @@ static void process_triblt(STREAM s, TRIBLT_ORDER *os,
&os->brush, os->bgcolour, os->fgcolour);
}
/* Parse a delta co-ordinate in polyline order form */
static int parse_delta(uint8 *buffer, int *offset)
{
int value = buffer[(*offset)++];
int two_byte = value & 0x80;
if (value & 0x40) /* sign bit */
value |= ~0x3f;
else
value &= 0x3f;
if (two_byte)
value = (value << 8) | buffer[(*offset)++];
return value;
}
/* Process a polyline order */
static void process_polyline(STREAM s, POLYLINE_ORDER *os,
uint32 present, BOOL delta)
{
int index, line, data;
int x, y, xfrom, yfrom;
uint8 flags = 0;
PEN pen;
if (present & 0x01)
rdp_in_coord(s, &os->x, delta);
if (present & 0x02)
rdp_in_coord(s, &os->y, delta);
if (present & 0x04)
in_uint8(s, os->flags);
if (present & 0x10)
rdp_in_colour(s, &os->fgcolour);
if (present & 0x20)
in_uint8(s, os->lines);
if (present & 0x40)
{
in_uint8(s, os->datasize);
in_uint8a(s, os->data, os->datasize);
}
DEBUG("POLYLINE(x=%d,y=%d,fl=0x%x,fg=0x%x,n=%d,sz=%d)\n",
os->x, os->y, os->flags, os->fgcolour, os->lines, os->datasize);
DEBUG("Data: ");
for (index = 0; index < os->datasize; index++)
DEBUG("%02x ", os->data[index]);
DEBUG("\n");
x = os->x;
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++)
{
xfrom = x;
yfrom = y;
if (line % 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);
ui_line(ROP2_COPY, xfrom, yfrom, x, y, &pen);
flags <<= 2;
}
}
/* Process a text order */
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
{
@ -515,7 +602,7 @@ static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
DEBUG("\n");
/* Process special cache strings */
if ((os->length == 2) && (os->text[0] == 0xfe))
if ((os->length >= 2) && (os->text[0] == 0xfe))
{
entry = cache_get_text(os->text[1]);
@ -824,6 +911,11 @@ void process_orders(STREAM s)
present, delta);
break;
case RDP_ORDER_POLYLINE:
process_polyline(s, &os->polyline,
present, delta);
break;
case RDP_ORDER_TEXT2:
process_text2(s, &os->text2,
present, delta);

View File

@ -37,6 +37,7 @@ enum RDP_ORDER_TYPE
RDP_ORDER_DESKSAVE = 11,
RDP_ORDER_MEMBLT = 13,
RDP_ORDER_TRIBLT = 14,
RDP_ORDER_POLYLINE = 22,
RDP_ORDER_TEXT2 = 27
};
@ -151,6 +152,20 @@ typedef struct _MEMBLT_ORDER
} MEMBLT_ORDER;
#define MAX_DATA 256
typedef struct _POLYLINE_ORDER
{
uint16 x;
uint16 y;
uint8 flags;
uint8 fgcolour;
uint8 lines;
uint8 datasize;
uint8 data[MAX_DATA];
} POLYLINE_ORDER;
#define MAX_TEXT 256
typedef struct _TEXT2_ORDER
@ -189,6 +204,7 @@ typedef struct _RDP_ORDER_STATE
DESKSAVE_ORDER desksave;
MEMBLT_ORDER memblt;
TRIBLT_ORDER triblt;
POLYLINE_ORDER polyline;
TEXT2_ORDER text2;
} RDP_ORDER_STATE;