/[rdesktop]/sourceforge.net/trunk/rdesktop/rdp.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/rdp.c

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

revision 207 by matthewc, Thu Sep 26 14:26:46 2002 UTC revision 318 by astrand, Mon Feb 10 12:58:51 2003 UTC
# Line 79  rdp_recv(uint8 * type) Line 79  rdp_recv(uint8 * type)
79          }          }
80    
81          in_uint16_le(rdp_s, length);          in_uint16_le(rdp_s, length);
82            /* 32k packets are really 8, keepalive fix */
83            if (length == 0x8000)
84            {
85                    next_packet += 8;
86                    *type = 0;
87                    return rdp_s;
88            }
89          in_uint16_le(rdp_s, pdu_type);          in_uint16_le(rdp_s, pdu_type);
90          in_uint8s(rdp_s, 2);    /* userid */          in_uint8s(rdp_s, 2);    /* userid */
91          *type = pdu_type & 0xf;          *type = pdu_type & 0xf;
# Line 545  process_bitmap_updates(STREAM s) Line 552  process_bitmap_updates(STREAM s)
552  {  {
553          uint16 num_updates;          uint16 num_updates;
554          uint16 left, top, right, bottom, width, height;          uint16 left, top, right, bottom, width, height;
555          uint16 cx, cy, bpp, compress, bufsize, size;          uint16 cx, cy, bpp, Bpp, compress, bufsize, size;
556          uint8 *data, *bmpdata;          uint8 *data, *bmpdata;
557          int i;          int i;
558    
# Line 560  process_bitmap_updates(STREAM s) Line 567  process_bitmap_updates(STREAM s)
567                  in_uint16_le(s, width);                  in_uint16_le(s, width);
568                  in_uint16_le(s, height);                  in_uint16_le(s, height);
569                  in_uint16_le(s, bpp);                  in_uint16_le(s, bpp);
570                    Bpp = (bpp + 7) / 8;
571                  in_uint16_le(s, compress);                  in_uint16_le(s, compress);
572                  in_uint16_le(s, bufsize);                  in_uint16_le(s, bufsize);
573    
# Line 572  process_bitmap_updates(STREAM s) Line 580  process_bitmap_updates(STREAM s)
580                  if (!compress)                  if (!compress)
581                  {                  {
582                          int y;                          int y;
583                          bmpdata = xmalloc(width * height);                          bmpdata = xmalloc(width * height * Bpp);
584                          for (y = 0; y < height; y++)                          for (y = 0; y < height; y++)
585                          {                          {
586                                  in_uint8a(s, &bmpdata[(height - y - 1) * width], width);                                  in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)],
587                                              width * Bpp);
588                          }                          }
589                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);
590                          xfree(bmpdata);                          xfree(bmpdata);
# Line 586  process_bitmap_updates(STREAM s) Line 595  process_bitmap_updates(STREAM s)
595                  in_uint16_le(s, size);                  in_uint16_le(s, size);
596                  in_uint8s(s, 4);        /* line_size, final_size */                  in_uint8s(s, 4);        /* line_size, final_size */
597                  in_uint8p(s, data, size);                  in_uint8p(s, data, size);
598                    bmpdata = xmalloc(width * height * Bpp);
599                  bmpdata = xmalloc(width * height);                  if (bitmap_decompress(bmpdata, width, height, data, size, Bpp))
                 if (bitmap_decompress(bmpdata, width, height, data, size))  
600                  {                  {
601                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);                          ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);
602                  }                  }
   
603                  xfree(bmpdata);                  xfree(bmpdata);
604          }          }
605  }  }
# Line 601  process_bitmap_updates(STREAM s) Line 608  process_bitmap_updates(STREAM s)
608  static void  static void
609  process_palette(STREAM s)  process_palette(STREAM s)
610  {  {
611          HCOLOURMAP hmap;          COLOURENTRY *entry;
612          COLOURMAP map;          COLOURMAP map;
613          uint8 *colours;          HCOLOURMAP hmap;
614            int i;
615    
616          in_uint8s(s, 2);        /* pad */          in_uint8s(s, 2);        /* pad */
617          in_uint16_le(s, map.ncolours);          in_uint16_le(s, map.ncolours);
618          in_uint8s(s, 2);        /* pad */          in_uint8s(s, 2);        /* pad */
619          in_uint8p(s, colours, (map.ncolours * 3));  
620          map.colours = (COLOURENTRY *) colours;          map.colours = xmalloc(3 * map.ncolours);
621    
622            for (i = 0; i < map.ncolours; i++)
623            {
624                    entry = &map.colours[i];
625                    in_uint8(s, entry->red);
626                    in_uint8(s, entry->green);
627                    in_uint8(s, entry->blue);
628            }
629    
630          hmap = ui_create_colourmap(&map);          hmap = ui_create_colourmap(&map);
631          ui_set_colourmap(hmap);          ui_set_colourmap(hmap);
632    
633            xfree(map.colours);
634  }  }
635    
636  /* Process an update PDU */  /* Process an update PDU */
# Line 701  rdp_main_loop(void) Line 719  rdp_main_loop(void)
719                                  process_data_pdu(s);                                  process_data_pdu(s);
720                                  break;                                  break;
721    
722                            case 0:
723                                    break;
724    
725                          default:                          default:
726                                  unimpl("PDU %d\n", type);                                  unimpl("PDU %d\n", type);
727                  }                  }

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

  ViewVC Help
Powered by ViewVC 1.1.26