/[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 82 by astrand, Tue Jul 30 07:18:48 2002 UTC revision 318 by astrand, Mon Feb 10 12:58:51 2003 UTC
# Line 1  Line 1 
1  /*  /*
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     RDP order processing     RDP order processing
4     Copyright (C) Matthew Chapman 1999-2001     Copyright (C) Matthew Chapman 1999-2002
5    
6     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 56  rdp_in_present(STREAM s, uint32 * presen Line 56  rdp_in_present(STREAM s, uint32 * presen
56  static void  static void
57  rdp_in_coord(STREAM s, uint16 * coord, BOOL delta)  rdp_in_coord(STREAM s, uint16 * coord, BOOL delta)
58  {  {
59          uint8 change;          sint8 change;
60    
61          if (delta)          if (delta)
62          {          {
63                  in_uint8(s, change);                  in_uint8(s, change);
64                  *coord += (signed char) change;                  *coord += change;
65          }          }
66          else          else
67          {          {
# Line 71  rdp_in_coord(STREAM s, uint16 * coord, B Line 71  rdp_in_coord(STREAM s, uint16 * coord, B
71    
72  /* Read a colour entry */  /* Read a colour entry */
73  static void  static void
74  rdp_in_colour(STREAM s, uint8 * colour)  rdp_in_colour(STREAM s, uint32 * colour)
75  {  {
76          in_uint8(s, *colour);          uint32 i;
77          s->p += 2;          in_uint8(s, i);
78            *colour = i;
79            in_uint8(s, i);
80            *colour |= i << 8;
81            in_uint8(s, i);
82            *colour |= i << 16;
83  }  }
84    
85  /* Parse bounds information */  /* Parse bounds information */
# Line 279  process_line(STREAM s, LINE_ORDER * os, Line 284  process_line(STREAM s, LINE_ORDER * os,
284  static void  static void
285  process_rect(STREAM s, RECT_ORDER * os, uint32 present, BOOL delta)  process_rect(STREAM s, RECT_ORDER * os, uint32 present, BOOL delta)
286  {  {
287            uint32 i;
288          if (present & 0x01)          if (present & 0x01)
289                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
290    
# Line 292  process_rect(STREAM s, RECT_ORDER * os, Line 298  process_rect(STREAM s, RECT_ORDER * os,
298                  rdp_in_coord(s, &os->cy, delta);                  rdp_in_coord(s, &os->cy, delta);
299    
300          if (present & 0x10)          if (present & 0x10)
301                  in_uint8(s, os->colour);          {
302                    in_uint8(s, i);
303                    os->colour = (os->colour & 0xffffff00) | i;
304            }
305    
306            if (present & 0x20)
307            {
308                    in_uint8(s, i);
309                    os->colour = (os->colour & 0xffff00ff) | (i << 8);
310            }
311    
312            if (present & 0x40)
313            {
314                    in_uint8(s, i);
315                    os->colour = (os->colour & 0xff00ffff) | (i << 16);
316            }
317    
318          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));
319    
# Line 475  process_polyline(STREAM s, POLYLINE_ORDE Line 496  process_polyline(STREAM s, POLYLINE_ORDE
496                  rdp_in_coord(s, &os->y, delta);                  rdp_in_coord(s, &os->y, delta);
497    
498          if (present & 0x04)          if (present & 0x04)
499                  in_uint8(s, os->flags);                  in_uint8(s, os->opcode);
500    
501          if (present & 0x10)          if (present & 0x10)
502                  rdp_in_colour(s, &os->fgcolour);                  rdp_in_colour(s, &os->fgcolour);
# Line 488  process_polyline(STREAM s, POLYLINE_ORDE Line 509  process_polyline(STREAM s, POLYLINE_ORDE
509                  in_uint8(s, os->datasize);                  in_uint8(s, os->datasize);
510                  in_uint8a(s, os->data, os->datasize);                  in_uint8a(s, os->data, os->datasize);
511          }          }
         if (os->flags & 1)  
                 opcode = ROP2_COPY;  
         else  
                 opcode = ROP2_NXOR;  
512    
513          DEBUG(("POLYLINE(x=%d,y=%d,fl=0x%x,fg=0x%x,n=%d,sz=%d)\n",          DEBUG(("POLYLINE(x=%d,y=%d,op=0x%x,fg=0x%x,n=%d,sz=%d)\n",
514                 os->x, os->y, os->flags, os->fgcolour, os->lines, os->datasize));                 os->x, os->y, os->opcode, os->fgcolour, os->lines, os->datasize));
515    
516          DEBUG(("Data: "));          DEBUG(("Data: "));
517    
# Line 503  process_polyline(STREAM s, POLYLINE_ORDE Line 520  process_polyline(STREAM s, POLYLINE_ORDE
520    
521          DEBUG(("\n"));          DEBUG(("\n"));
522    
523            if (os->opcode < 0x01 || os->opcode > 0x10)
524            {
525                    error("bad ROP2 0x%x\n", os->opcode);
526                    return;
527            }
528    
529            opcode = os->opcode - 1;
530          x = os->x;          x = os->x;
531          y = os->y;          y = os->y;
532          pen.style = pen.width = 0;          pen.style = pen.width = 0;
# Line 617  process_raw_bmpcache(STREAM s) Line 641  process_raw_bmpcache(STREAM s)
641  {  {
642          HBITMAP bitmap;          HBITMAP bitmap;
643          uint16 cache_idx, bufsize;          uint16 cache_idx, bufsize;
644          uint8 cache_id, width, height, bpp;          uint8 cache_id, width, height, bpp, Bpp;
645          uint8 *data, *inverted;          uint8 *data, *inverted;
646          int y;          int y;
647    
# Line 626  process_raw_bmpcache(STREAM s) Line 650  process_raw_bmpcache(STREAM s)
650          in_uint8(s, width);          in_uint8(s, width);
651          in_uint8(s, height);          in_uint8(s, height);
652          in_uint8(s, bpp);          in_uint8(s, bpp);
653            Bpp = (bpp + 7) / 8;
654          in_uint16_le(s, bufsize);          in_uint16_le(s, bufsize);
655          in_uint16_le(s, cache_idx);          in_uint16_le(s, cache_idx);
656          in_uint8p(s, data, bufsize);          in_uint8p(s, data, bufsize);
657    
658          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));
659          inverted = xmalloc(width * height);          inverted = xmalloc(width * height * Bpp);
660          for (y = 0; y < height; y++)          for (y = 0; y < height; y++)
661          {          {
662                  memcpy(&inverted[(height - y - 1) * width], &data[y * width], width);                  memcpy(&inverted[(height - y - 1) * (width * Bpp)], &data[y * (width * Bpp)],
663                           width * Bpp);
664          }          }
665    
666          bitmap = ui_create_bitmap(width, height, inverted);          bitmap = ui_create_bitmap(width, height, inverted);
# Line 648  process_bmpcache(STREAM s) Line 674  process_bmpcache(STREAM s)
674  {  {
675          HBITMAP bitmap;          HBITMAP bitmap;
676          uint16 cache_idx, size;          uint16 cache_idx, size;
677          uint8 cache_id, width, height, bpp;          uint8 cache_id, width, height, bpp, Bpp;
678          uint8 *data, *bmpdata;          uint8 *data, *bmpdata;
679    
680          in_uint8(s, cache_id);          in_uint8(s, cache_id);
# Line 656  process_bmpcache(STREAM s) Line 682  process_bmpcache(STREAM s)
682          in_uint8(s, width);          in_uint8(s, width);
683          in_uint8(s, height);          in_uint8(s, height);
684          in_uint8(s, bpp);          in_uint8(s, bpp);
685            Bpp = (bpp + 7) / 8;
686          in_uint8s(s, 2);        /* bufsize */          in_uint8s(s, 2);        /* bufsize */
687          in_uint16_le(s, cache_idx);          in_uint16_le(s, cache_idx);
688          in_uint8s(s, 2);        /* pad */          in_uint8s(s, 2);        /* pad */
# Line 665  process_bmpcache(STREAM s) Line 692  process_bmpcache(STREAM s)
692    
693          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));
694    
695          bmpdata = xmalloc(width * height);          bmpdata = xmalloc(width * height * Bpp);
696    
697          if (bitmap_decompress(bmpdata, width, height, data, size))          if (bitmap_decompress(bmpdata, width, height, data, size, Bpp))
698          {          {
699                  bitmap = ui_create_bitmap(width, height, bmpdata);                  bitmap = ui_create_bitmap(width, height, bmpdata);
700                  cache_put_bitmap(cache_id, cache_idx, bitmap);                  cache_put_bitmap(cache_id, cache_idx, bitmap);
# Line 907  process_orders(STREAM s) Line 934  process_orders(STREAM s)
934    
935  /* Reset order state */  /* Reset order state */
936  void  void
937  reset_order_state()  reset_order_state(void)
938  {  {
939          memset(&order_state, 0, sizeof(order_state));          memset(&order_state, 0, sizeof(order_state));
940          order_state.order_type = RDP_ORDER_PATBLT;          order_state.order_type = RDP_ORDER_PATBLT;

Legend:
Removed from v.82  
changed lines
  Added in v.318

  ViewVC Help
Powered by ViewVC 1.1.26