/[rdesktop]/sourceforge.net/trunk/rdesktop/orders.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/orders.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 23 by matty, Tue Oct 17 08:24:09 2000 UTC revision 24 by matty, Sat Jan 6 03:12:10 2001 UTC
# Line 59  static void rdp_in_coord(STREAM s, uint1 Line 59  static void rdp_in_coord(STREAM s, uint1
59          if (delta)          if (delta)
60          {          {
61                  in_uint8(s, change);                  in_uint8(s, change);
62                  *coord += (char)change;                  *coord += (char) change;
63          }          }
64          else          else
65          {          {
# Line 142  static BOOL rdp_parse_brush(STREAM s, BR Line 142  static BOOL rdp_parse_brush(STREAM s, BR
142    
143  /* Process a destination blt order */  /* Process a destination blt order */
144  static void process_destblt(STREAM s, DESTBLT_ORDER *os,  static void process_destblt(STREAM s, DESTBLT_ORDER *os,
145                                  uint32 present, BOOL delta)                              uint32 present, BOOL delta)
146  {  {
147          if (present & 0x01)          if (present & 0x01)
148                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 167  static void process_destblt(STREAM s, DE Line 167  static void process_destblt(STREAM s, DE
167    
168  /* Process a pattern blt order */  /* Process a pattern blt order */
169  static void process_patblt(STREAM s, PATBLT_ORDER *os,  static void process_patblt(STREAM s, PATBLT_ORDER *os,
170                                  uint32 present, BOOL delta)                             uint32 present, BOOL delta)
171  {  {
172          if (present & 0x0001)          if (present & 0x0001)
173                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 197  static void process_patblt(STREAM s, PAT Line 197  static void process_patblt(STREAM s, PAT
197                os->brush.style, os->bgcolour, os->fgcolour);                os->brush.style, os->bgcolour, os->fgcolour);
198    
199          ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy,          ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy,
200                                  &os->brush, os->bgcolour, os->fgcolour);                    &os->brush, os->bgcolour, os->fgcolour);
201  }  }
202    
203  /* Process a screen blt order */  /* Process a screen blt order */
204  static void process_screenblt(STREAM s, SCREENBLT_ORDER *os,  static void process_screenblt(STREAM s, SCREENBLT_ORDER *os,
205                                          uint32 present, BOOL delta)                                uint32 present, BOOL delta)
206  {  {
207          if (present & 0x0001)          if (present & 0x0001)
208                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 229  static void process_screenblt(STREAM s, Line 229  static void process_screenblt(STREAM s,
229                os->opcode, os->x, os->y, os->cx, os->cy, os->srcx, os->srcy);                os->opcode, os->x, os->y, os->cx, os->cy, os->srcx, os->srcy);
230    
231          ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy,          ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy,
232                                  os->srcx, os->srcy);                       os->srcx, os->srcy);
233  }  }
234    
235  /* Process a line order */  /* Process a line order */
# Line 268  static void process_line(STREAM s, LINE_ Line 268  static void process_line(STREAM s, LINE_
268                  return;                  return;
269          }          }
270    
271          ui_line(os->opcode-1, os->startx, os->starty,          ui_line(os->opcode - 1, os->startx, os->starty,
272                          os->endx, os->endy, &os->pen);                  os->endx, os->endy, &os->pen);
273  }  }
274    
275  /* Process an opaque rectangle order */  /* Process an opaque rectangle order */
# Line 298  static void process_rect(STREAM s, RECT_ Line 298  static void process_rect(STREAM s, RECT_
298    
299  /* Process a desktop save order */  /* Process a desktop save order */
300  static void process_desksave(STREAM s, DESKSAVE_ORDER *os,  static void process_desksave(STREAM s, DESKSAVE_ORDER *os,
301                                  uint32 present, BOOL delta)                               uint32 present, BOOL delta)
302  {  {
303          int width, height;          int width, height;
304    
# Line 330  static void process_desksave(STREAM s, D Line 330  static void process_desksave(STREAM s, D
330          if (os->action == 0)          if (os->action == 0)
331                  ui_desktop_save(os->offset, os->left, os->top, width, height);                  ui_desktop_save(os->offset, os->left, os->top, width, height);
332          else          else
333                  ui_desktop_restore(os->offset, os->left, os->top, width, height);                  ui_desktop_restore(os->offset, os->left, os->top, width,
334                                       height);
335  }  }
336    
337  /* Process a memory blt order */  /* Process a memory blt order */
338  static void process_memblt(STREAM s, MEMBLT_ORDER *os,  static void process_memblt(STREAM s, MEMBLT_ORDER *os,
339                                  uint32 present, BOOL delta)                             uint32 present, BOOL delta)
340  {  {
341          HBITMAP bitmap;          HBITMAP bitmap;
342    
# Line 378  static void process_memblt(STREAM s, MEM Line 379  static void process_memblt(STREAM s, MEM
379                  return;                  return;
380    
381          ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy,          ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy,
382                          bitmap, os->srcx, os->srcy);                    bitmap, os->srcx, os->srcy);
383  }  }
384    
385  /* Process a 3-way blt order */  /* Process a 3-way blt order */
386  static void process_triblt(STREAM s, TRIBLT_ORDER *os,  static void process_triblt(STREAM s, TRIBLT_ORDER *os,
387                                  uint32 present, BOOL delta)                             uint32 present, BOOL delta)
388  {  {
389          HBITMAP bitmap;          HBITMAP bitmap;
390    
# Line 428  static void process_triblt(STREAM s, TRI Line 429  static void process_triblt(STREAM s, TRI
429          if (present & 0x010000)          if (present & 0x010000)
430                  in_uint16_le(s, os->unknown);                  in_uint16_le(s, os->unknown);
431    
432          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",          DEBUG
433                os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id,                  ("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",
434                os->cache_idx, os->brush.style, os->bgcolour, os->fgcolour);                   os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id,
435                     os->cache_idx, os->brush.style, os->bgcolour, os->fgcolour);
436    
437          bitmap = cache_get_bitmap(os->cache_id, os->cache_idx);          bitmap = cache_get_bitmap(os->cache_id, os->cache_idx);
438          if (bitmap == NULL)          if (bitmap == NULL)
439                  return;                  return;
440    
441          ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy,          ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy,
442                          bitmap, os->srcx, os->srcy,                    bitmap, os->srcx, os->srcy,
443                          &os->brush, os->bgcolour, os->fgcolour);                    &os->brush, os->bgcolour, os->fgcolour);
444  }  }
445    
446  /* Parse a delta co-ordinate in polyline order form */  /* Parse a delta co-ordinate in polyline order form */
# Line 447  static int parse_delta(uint8 *buffer, in Line 449  static int parse_delta(uint8 *buffer, in
449          int value = buffer[(*offset)++];          int value = buffer[(*offset)++];
450          int two_byte = value & 0x80;          int two_byte = value & 0x80;
451    
452          if (value & 0x40) /* sign bit */          if (value & 0x40)       /* sign bit */
453                  value |= ~0x3f;                  value |= ~0x3f;
454          else          else
455                  value &= 0x3f;                  value &= 0x3f;
# Line 460  static int parse_delta(uint8 *buffer, in Line 462  static int parse_delta(uint8 *buffer, in
462    
463  /* Process a polyline order */  /* Process a polyline order */
464  static void process_polyline(STREAM s, POLYLINE_ORDER *os,  static void process_polyline(STREAM s, POLYLINE_ORDER *os,
465                                  uint32 present, BOOL delta)                               uint32 present, BOOL delta)
466  {  {
467          int index, line, data;          int index, line, data;
468          int x, y, xfrom, yfrom;          int x, y, xfrom, yfrom;
# Line 489  static void process_polyline(STREAM s, P Line 491  static void process_polyline(STREAM s, P
491          }          }
492    
493          DEBUG("POLYLINE(x=%d,y=%d,fl=0x%x,fg=0x%x,n=%d,sz=%d)\n",          DEBUG("POLYLINE(x=%d,y=%d,fl=0x%x,fg=0x%x,n=%d,sz=%d)\n",
494                  os->x, os->y, os->flags, os->fgcolour, os->lines, os->datasize);                os->x, os->y, os->flags, os->fgcolour, os->lines, os->datasize);
495    
496          DEBUG("Data: ");          DEBUG("Data: ");
497    
# Line 514  static void process_polyline(STREAM s, P Line 516  static void process_polyline(STREAM s, P
516                          flags = os->data[index++];                          flags = os->data[index++];
517    
518                  if ((flags & 0xc0) == 0)                  if ((flags & 0xc0) == 0)
519                          flags |= 0xc0;   /* none = both */                          flags |= 0xc0;  /* none = both */
520    
521                  if (flags & 0x40)                  if (flags & 0x40)
522                          x += parse_delta(os->data, &data);                          x += parse_delta(os->data, &data);
# Line 529  static void process_polyline(STREAM s, P Line 531  static void process_polyline(STREAM s, P
531  }  }
532    
533  /* Process a text order */  /* Process a text order */
534  static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)  static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present,
535                              BOOL delta)
536  {  {
537          DATABLOB *entry;          DATABLOB *entry;
538          int i;          int i;
# Line 588  static void process_text2(STREAM s, TEXT Line 591  static void process_text2(STREAM s, TEXT
591                  in_uint8a(s, os->text, os->length);                  in_uint8a(s, os->text, os->length);
592          }          }
593    
594          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",          DEBUG
595                  os->x, os->y, os->clipleft, os->cliptop, os->clipright,                  ("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",
596                  os->clipbottom, os->boxleft, os->boxtop, os->boxright,                   os->x, os->y, os->clipleft, os->cliptop, os->clipright,
597                  os->boxbottom, os->fgcolour, os->bgcolour, os->font,                   os->clipbottom, os->boxleft, os->boxtop, os->boxright,
598                  os->flags, os->mixmode, os->unknown, os->length);                   os->boxbottom, os->fgcolour, os->bgcolour, os->font,
599                     os->flags, os->mixmode, os->unknown, os->length);
600    
601          DEBUG("Text: ");          DEBUG("Text: ");
602    
# Line 608  static void process_text2(STREAM s, TEXT Line 612  static void process_text2(STREAM s, TEXT
612    
613                  if (entry == NULL)                  if (entry == NULL)
614                          return;                          return;
615                    
616                  memcpy(os->text, entry->data, entry->size);                  memcpy(os->text, entry->data, entry->size);
617                  os->length = entry->size;                  os->length = entry->size;
618          }          }
619          else if ((os->length >= 3) && (os->text[os->length-3] == 0xff))          else if ((os->length >= 3) && (os->text[os->length - 3] == 0xff))
620          {          {
621                  os->length -= 3;                  os->length -= 3;
622                  cache_put_text(os->text[os->length+1], os->text, os->length);                  cache_put_text(os->text[os->length + 1], os->text,
623                                   os->length);
624          }          }
625    
626          ui_draw_text(os->font, os->flags, os->mixmode, os->x, os->y,          ui_draw_text(os->font, os->flags, os->mixmode, os->x, os->y,
627                          os->clipleft, os->cliptop,                       os->clipleft, os->cliptop,
628                          os->clipright - os->clipleft,                       os->clipright - os->clipleft,
629                          os->clipbottom - os->cliptop,                       os->clipbottom - os->cliptop,
630                          os->boxleft, os->boxtop,                       os->boxleft, os->boxtop,
631                          os->boxright - os->boxleft,                       os->boxright - os->boxleft,
632                          os->boxbottom - os->boxtop,                       os->boxbottom - os->boxtop,
633                          os->bgcolour, os->fgcolour, os->text, os->length);                       os->bgcolour, os->fgcolour, os->text, os->length);
634  }  }
635    
636  /* Process a raw bitmap cache order */  /* Process a raw bitmap cache order */
# Line 637  static void process_raw_bmpcache(STREAM Line 642  static void process_raw_bmpcache(STREAM
642          uint8 *data;          uint8 *data;
643    
644          in_uint8(s, cache_id);          in_uint8(s, cache_id);
645          in_uint8s(s, 1); /* pad */          in_uint8s(s, 1);        /* pad */
646          in_uint8(s, width);          in_uint8(s, width);
647          in_uint8(s, height);          in_uint8(s, height);
648          in_uint8(s, bpp);          in_uint8(s, bpp);
# Line 661  static void process_bmpcache(STREAM s) Line 666  static void process_bmpcache(STREAM s)
666          uint8 *data, *bmpdata;          uint8 *data, *bmpdata;
667    
668          in_uint8(s, cache_id);          in_uint8(s, cache_id);
669          in_uint8s(s, 1); /* pad */          in_uint8s(s, 1);        /* pad */
670          in_uint8(s, width);          in_uint8(s, width);
671          in_uint8(s, height);          in_uint8(s, height);
672          in_uint8(s, bpp);          in_uint8(s, bpp);
673          in_uint8s(s, 2); /* bufsize */          in_uint8s(s, 2);        /* bufsize */
674          in_uint16_le(s, cache_idx);          in_uint16_le(s, cache_idx);
675          in_uint8s(s, 2); /* pad */          in_uint8s(s, 2);        /* pad */
676          in_uint16_le(s, size);          in_uint16_le(s, size);
677          in_uint8s(s, 4); /* row_size, final_size */          in_uint8s(s, 4);        /* row_size, final_size */
678          in_uint8p(s, data, size);          in_uint8p(s, data, size);
679    
680          DEBUG("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n",          DEBUG("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n",
# Line 706  static void process_colcache(STREAM s) Line 711  static void process_colcache(STREAM s)
711                  in_uint8(s, entry->blue);                  in_uint8(s, entry->blue);
712                  in_uint8(s, entry->green);                  in_uint8(s, entry->green);
713                  in_uint8(s, entry->red);                  in_uint8(s, entry->red);
714                  in_uint8s(s, 1); /* pad */                  in_uint8s(s, 1);        /* pad */
715          }          }
716    
717          DEBUG("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours);          DEBUG("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours);
# Line 723  static void process_fontcache(STREAM s) Line 728  static void process_fontcache(STREAM s)
728          HGLYPH bitmap;          HGLYPH bitmap;
729          uint8 font, nglyphs;          uint8 font, nglyphs;
730          uint16 character, offset, baseline, width, height;          uint16 character, offset, baseline, width, height;
731          uint8 *data, *rev_data, in, out;          int i, datasize;
732          int i, j, datasize;          uint8 *data;
733    
734          in_uint8(s, font);          in_uint8(s, font);
735          in_uint8(s, nglyphs);          in_uint8(s, nglyphs);
# Line 744  static void process_fontcache(STREAM s) Line 749  static void process_fontcache(STREAM s)
749    
750                  bitmap = ui_create_glyph(width, height, data);                  bitmap = ui_create_glyph(width, height, data);
751                  cache_put_font(font, character, offset, baseline,                  cache_put_font(font, character, offset, baseline,
752                                  width, height, bitmap);                                 width, height, bitmap);
753          }          }
754  }  }
755    
# Line 756  static void process_secondary_order(STRE Line 761  static void process_secondary_order(STRE
761          uint8 *next_order;          uint8 *next_order;
762    
763          in_uint16_le(s, length);          in_uint16_le(s, length);
764          in_uint8s(s, 2); /* flags */          in_uint8s(s, 2);        /* flags */
765          in_uint8(s, type);          in_uint8(s, type);
766    
767          next_order = s->p + length + 7;          next_order = s->p + length + 7;
# Line 796  void process_orders(STREAM s) Line 801  void process_orders(STREAM s)
801          int size, processed = 0;          int size, processed = 0;
802          BOOL delta;          BOOL delta;
803    
804          in_uint8s(s, 2); /* pad */          in_uint8s(s, 2);        /* pad */
805          in_uint16_le(s, num_orders);          in_uint16_le(s, num_orders);
806          in_uint8s(s, 2); /* pad */          in_uint8s(s, 2);        /* pad */
807    
808          while (processed < num_orders)          while (processed < num_orders)
809          {          {
# Line 846  void process_orders(STREAM s) Line 851  void process_orders(STREAM s)
851                                          rdp_parse_bounds(s, &os->bounds);                                          rdp_parse_bounds(s, &os->bounds);
852    
853                                  ui_set_clip(os->bounds.left,                                  ui_set_clip(os->bounds.left,
854                                          os->bounds.top,                                              os->bounds.top,
855                                          os->bounds.right - os->bounds.left + 1,                                              os->bounds.right -
856                                          os->bounds.bottom - os->bounds.top + 1);                                              os->bounds.left + 1,
857                                                os->bounds.bottom -
858                                                os->bounds.top + 1);
859                          }                          }
860    
861                          delta = order_flags & RDP_ORDER_DELTA;                          delta = order_flags & RDP_ORDER_DELTA;
# Line 872  void process_orders(STREAM s) Line 879  void process_orders(STREAM s)
879    
880                                  case RDP_ORDER_LINE:                                  case RDP_ORDER_LINE:
881                                          process_line(s, &os->line,                                          process_line(s, &os->line,
882                                                          present, delta);                                                       present, delta);
883                                          break;                                          break;
884    
885                                  case RDP_ORDER_RECT:                                  case RDP_ORDER_RECT:
# Line 918  void process_orders(STREAM s) Line 925  void process_orders(STREAM s)
925          }          }
926    
927          if (s->p != next_packet)          if (s->p != next_packet)
928                  WARN("%d bytes remaining\n", (int)(next_packet - s->p));                  WARN("%d bytes remaining\n", (int) (next_packet - s->p));
929  }  }
930    
931  /* Reset order state */  /* Reset order state */
# Line 926  void reset_order_state() Line 933  void reset_order_state()
933  {  {
934          memset(&order_state, 0, sizeof(order_state));          memset(&order_state, 0, sizeof(order_state));
935  }  }
   

Legend:
Removed from v.23  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26