--- sourceforge.net/trunk/rdesktop/orders.c 2002/07/12 03:45:20 55 +++ sourceforge.net/trunk/rdesktop/orders.c 2002/07/30 07:18:48 82 @@ -26,7 +26,7 @@ /* Read field indicating which parameters are present */ static void -rdp_in_present(STREAM s, uint32 *present, uint8 flags, int size) +rdp_in_present(STREAM s, uint32 * present, uint8 flags, int size) { uint8 bits; int i; @@ -54,7 +54,7 @@ /* Read a co-ordinate (16-bit, or 8-bit delta) */ static void -rdp_in_coord(STREAM s, uint16 *coord, BOOL delta) +rdp_in_coord(STREAM s, uint16 * coord, BOOL delta) { uint8 change; @@ -71,7 +71,7 @@ /* Read a colour entry */ static void -rdp_in_colour(STREAM s, uint8 *colour) +rdp_in_colour(STREAM s, uint8 * colour) { in_uint8(s, *colour); s->p += 2; @@ -79,7 +79,7 @@ /* Parse bounds information */ static BOOL -rdp_parse_bounds(STREAM s, BOUNDS *bounds) +rdp_parse_bounds(STREAM s, BOUNDS * bounds) { uint8 present; @@ -110,7 +110,7 @@ /* Parse a pen */ static BOOL -rdp_parse_pen(STREAM s, PEN *pen, uint32 present) +rdp_parse_pen(STREAM s, PEN * pen, uint32 present) { if (present & 1) in_uint8(s, pen->style); @@ -126,7 +126,7 @@ /* Parse a brush */ static BOOL -rdp_parse_brush(STREAM s, BRUSH *brush, uint32 present) +rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present) { if (present & 1) in_uint8(s, brush->xorigin); @@ -148,7 +148,7 @@ /* Process a destination blt order */ static void -process_destblt(STREAM s, DESTBLT_ORDER *os, uint32 present, BOOL delta) +process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, BOOL delta) { if (present & 0x01) rdp_in_coord(s, &os->x, delta); @@ -173,7 +173,7 @@ /* Process a pattern blt order */ static void -process_patblt(STREAM s, PATBLT_ORDER *os, uint32 present, BOOL delta) +process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, BOOL delta) { if (present & 0x0001) rdp_in_coord(s, &os->x, delta); @@ -198,9 +198,8 @@ rdp_parse_brush(s, &os->brush, present >> 7); - DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", - os->opcode, os->x, os->y, os->cx, os->cy, - os->brush.style, os->bgcolour, os->fgcolour)); + DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x, + os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour)); ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy, &os->brush, os->bgcolour, os->fgcolour); @@ -208,7 +207,7 @@ /* Process a screen blt order */ static void -process_screenblt(STREAM s, SCREENBLT_ORDER *os, uint32 present, BOOL delta) +process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, BOOL delta) { if (present & 0x0001) rdp_in_coord(s, &os->x, delta); @@ -234,13 +233,12 @@ DEBUG(("SCREENBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,srcx=%d,srcy=%d)\n", os->opcode, os->x, os->y, os->cx, os->cy, os->srcx, os->srcy)); - ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, - os->srcx, os->srcy); + ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, os->srcx, os->srcy); } /* Process a line order */ static void -process_line(STREAM s, LINE_ORDER *os, uint32 present, BOOL delta) +process_line(STREAM s, LINE_ORDER * os, uint32 present, BOOL delta) { if (present & 0x0001) in_uint16_le(s, os->mixmode); @@ -266,8 +264,7 @@ rdp_parse_pen(s, &os->pen, present >> 7); DEBUG(("LINE(op=0x%x,sx=%d,sy=%d,dx=%d,dx=%d,fg=0x%x)\n", - os->opcode, os->startx, os->starty, os->endx, os->endy, - os->pen.colour)); + os->opcode, os->startx, os->starty, os->endx, os->endy, os->pen.colour)); if (os->opcode < 0x01 || os->opcode > 0x10) { @@ -275,13 +272,12 @@ return; } - ui_line(os->opcode - 1, os->startx, os->starty, - os->endx, os->endy, &os->pen); + ui_line(os->opcode - 1, os->startx, os->starty, os->endx, os->endy, &os->pen); } /* Process an opaque rectangle order */ static void -process_rect(STREAM s, RECT_ORDER *os, uint32 present, BOOL delta) +process_rect(STREAM s, RECT_ORDER * os, uint32 present, BOOL delta) { if (present & 0x01) rdp_in_coord(s, &os->x, delta); @@ -298,15 +294,14 @@ if (present & 0x10) in_uint8(s, os->colour); - DEBUG(("RECT(x=%d,y=%d,cx=%d,cy=%d,fg=0x%x)\n", - os->x, os->y, os->cx, os->cy, os->colour)); + DEBUG(("RECT(x=%d,y=%d,cx=%d,cy=%d,fg=0x%x)\n", os->x, os->y, os->cx, os->cy, os->colour)); ui_rect(os->x, os->y, os->cx, os->cy, os->colour); } /* Process a desktop save order */ static void -process_desksave(STREAM s, DESKSAVE_ORDER *os, uint32 present, BOOL delta) +process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, BOOL delta) { int width, height; @@ -329,8 +324,7 @@ in_uint8(s, os->action); DEBUG(("DESKSAVE(l=%d,t=%d,r=%d,b=%d,off=%d,op=%d)\n", - os->left, os->top, os->right, os->bottom, os->offset, - os->action)); + os->left, os->top, os->right, os->bottom, os->offset, os->action)); width = os->right - os->left + 1; height = os->bottom - os->top + 1; @@ -338,13 +332,12 @@ if (os->action == 0) ui_desktop_save(os->offset, os->left, os->top, width, height); else - ui_desktop_restore(os->offset, os->left, os->top, width, - height); + ui_desktop_restore(os->offset, os->left, os->top, width, height); } /* Process a memory blt order */ static void -process_memblt(STREAM s, MEMBLT_ORDER *os, uint32 present, BOOL delta) +process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta) { HBITMAP bitmap; @@ -379,20 +372,18 @@ in_uint16_le(s, os->cache_idx); DEBUG(("MEMBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d)\n", - os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, - os->cache_idx)); + os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx)); bitmap = cache_get_bitmap(os->cache_id, os->cache_idx); if (bitmap == NULL) return; - ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, - bitmap, os->srcx, os->srcy); + ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, bitmap, os->srcx, os->srcy); } /* Process a 3-way blt order */ static void -process_triblt(STREAM s, TRIBLT_ORDER *os, uint32 present, BOOL delta) +process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, BOOL delta) { HBITMAP bitmap; @@ -438,21 +429,20 @@ in_uint16_le(s, os->unknown); DEBUG(("TRIBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d,bs=%d,bg=0x%x,fg=0x%x)\n", - os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, - os->cache_idx, os->brush.style, os->bgcolour, os->fgcolour)); + os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx, + os->brush.style, os->bgcolour, os->fgcolour)); bitmap = cache_get_bitmap(os->cache_id, os->cache_idx); if (bitmap == NULL) return; ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, - bitmap, os->srcx, os->srcy, - &os->brush, os->bgcolour, os->fgcolour); + bitmap, os->srcx, os->srcy, &os->brush, os->bgcolour, os->fgcolour); } /* Parse a delta co-ordinate in polyline order form */ static int -parse_delta(uint8 *buffer, int *offset) +parse_delta(uint8 * buffer, int *offset) { int value = buffer[(*offset)++]; int two_byte = value & 0x80; @@ -470,7 +460,7 @@ /* Process a polyline order */ static void -process_polyline(STREAM s, POLYLINE_ORDER *os, uint32 present, BOOL delta) +process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta) { int index, line, data; int x, y, xfrom, yfrom; @@ -545,7 +535,7 @@ /* Process a text order */ static void -process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta) +process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, BOOL delta) { int i; @@ -603,11 +593,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,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(("Text: ")); @@ -622,8 +608,7 @@ os->clipbottom - os->cliptop, os->boxleft, os->boxtop, os->boxright - os->boxleft, - os->boxbottom - os->boxtop, - os->bgcolour, os->fgcolour, os->text, os->length); + os->boxbottom - os->boxtop, os->bgcolour, os->fgcolour, os->text, os->length); } /* Process a raw bitmap cache order */ @@ -645,13 +630,11 @@ in_uint16_le(s, cache_idx); in_uint8p(s, data, bufsize); - DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", - width, height, cache_id, cache_idx)); + DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); inverted = xmalloc(width * height); for (y = 0; y < height; y++) { - memcpy(&inverted[(height - y - 1) * width], &data[y * width], - width); + memcpy(&inverted[(height - y - 1) * width], &data[y * width], width); } bitmap = ui_create_bitmap(width, height, inverted); @@ -680,8 +663,7 @@ in_uint8s(s, 4); /* row_size, final_size */ in_uint8p(s, data, size); - DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", - width, height, cache_id, cache_idx)); + DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); bmpdata = xmalloc(width * height); @@ -753,8 +735,7 @@ in_uint8p(s, data, datasize); bitmap = ui_create_glyph(width, height, data); - cache_put_font(font, character, offset, baseline, - width, height, bitmap); + cache_put_font(font, character, offset, baseline, width, height, bitmap); } } @@ -861,8 +842,7 @@ os->bounds.top, os->bounds.right - os->bounds.left + 1, - os->bounds.bottom - - os->bounds.top + 1); + os->bounds.bottom - os->bounds.top + 1); } delta = order_flags & RDP_ORDER_DELTA; @@ -870,53 +850,43 @@ switch (os->order_type) { case RDP_ORDER_DESTBLT: - process_destblt(s, &os->destblt, - present, delta); + process_destblt(s, &os->destblt, present, delta); break; case RDP_ORDER_PATBLT: - process_patblt(s, &os->patblt, - present, delta); + process_patblt(s, &os->patblt, present, delta); break; case RDP_ORDER_SCREENBLT: - process_screenblt(s, &os->screenblt, - present, delta); + process_screenblt(s, &os->screenblt, present, delta); break; case RDP_ORDER_LINE: - process_line(s, &os->line, - present, delta); + process_line(s, &os->line, present, delta); break; case RDP_ORDER_RECT: - process_rect(s, &os->rect, - present, delta); + process_rect(s, &os->rect, present, delta); break; case RDP_ORDER_DESKSAVE: - process_desksave(s, &os->desksave, - present, delta); + process_desksave(s, &os->desksave, present, delta); break; case RDP_ORDER_MEMBLT: - process_memblt(s, &os->memblt, - present, delta); + process_memblt(s, &os->memblt, present, delta); break; case RDP_ORDER_TRIBLT: - process_triblt(s, &os->triblt, - present, delta); + process_triblt(s, &os->triblt, present, delta); break; case RDP_ORDER_POLYLINE: - process_polyline(s, &os->polyline, - present, delta); + process_polyline(s, &os->polyline, present, delta); break; case RDP_ORDER_TEXT2: - process_text2(s, &os->text2, - present, delta); + process_text2(s, &os->text2, present, delta); break; default: