/[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 831 by jdmeijer, Tue Mar 8 00:43:10 2005 UTC revision 1365 by jsorg71, Thu Jan 4 05:39:39 2007 UTC
# Line 1  Line 1 
1  /* -*- c-basic-offset: 8 -*-  /* -*- c-basic-offset: 8 -*-
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-2005     Copyright (C) Matthew Chapman 1999-2007
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 379  process_desksave(STREAM s, DESKSAVE_ORDE Line 379  process_desksave(STREAM s, DESKSAVE_ORDE
379  static void  static void
380  process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta)  process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta)
381  {  {
382          HBITMAP bitmap;          RD_HBITMAP bitmap;
383    
384          if (present & 0x0001)          if (present & 0x0001)
385          {          {
# Line 425  process_memblt(STREAM s, MEMBLT_ORDER * Line 425  process_memblt(STREAM s, MEMBLT_ORDER *
425  static void  static void
426  process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, BOOL delta)  process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, BOOL delta)
427  {  {
428          HBITMAP bitmap;          RD_HBITMAP bitmap;
429    
430          if (present & 0x000001)          if (present & 0x000001)
431          {          {
# Line 486  process_polygon(STREAM s, POLYGON_ORDER Line 486  process_polygon(STREAM s, POLYGON_ORDER
486  {  {
487          int index, data, next;          int index, data, next;
488          uint8 flags = 0;          uint8 flags = 0;
489          POINT *points;          RD_POINT *points;
490    
491          if (present & 0x01)          if (present & 0x01)
492                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 528  process_polygon(STREAM s, POLYGON_ORDER Line 528  process_polygon(STREAM s, POLYGON_ORDER
528                  return;                  return;
529          }          }
530    
531          points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT));          points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT));
532          memset(points, 0, (os->npoints + 1) * sizeof(POINT));          memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT));
533    
534          points[0].x = os->x;          points[0].x = os->x;
535          points[0].y = os->y;          points[0].y = os->y;
# Line 565  process_polygon2(STREAM s, POLYGON2_ORDE Line 565  process_polygon2(STREAM s, POLYGON2_ORDE
565  {  {
566          int index, data, next;          int index, data, next;
567          uint8 flags = 0;          uint8 flags = 0;
568          POINT *points;          RD_POINT *points;
569    
570          if (present & 0x0001)          if (present & 0x0001)
571                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 613  process_polygon2(STREAM s, POLYGON2_ORDE Line 613  process_polygon2(STREAM s, POLYGON2_ORDE
613                  return;                  return;
614          }          }
615    
616          points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT));          points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT));
617          memset(points, 0, (os->npoints + 1) * sizeof(POINT));          memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT));
618    
619          points[0].x = os->x;          points[0].x = os->x;
620          points[0].y = os->y;          points[0].y = os->y;
# Line 648  process_polygon2(STREAM s, POLYGON2_ORDE Line 648  process_polygon2(STREAM s, POLYGON2_ORDE
648  static void  static void
649  process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta)  process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta)
650  {  {
651          int index, line, data;          int index, next, data;
         int x, y, xfrom, yfrom;  
652          uint8 flags = 0;          uint8 flags = 0;
653          PEN pen;          PEN pen;
654          uint8 opcode;          RD_POINT *points;
655    
656          if (present & 0x01)          if (present & 0x01)
657                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 691  process_polyline(STREAM s, POLYLINE_ORDE Line 690  process_polyline(STREAM s, POLYLINE_ORDE
690                  return;                  return;
691          }          }
692    
693          opcode = os->opcode - 1;          points = (RD_POINT *) xmalloc((os->lines + 1) * sizeof(RD_POINT));
694          x = os->x;          memset(points, 0, (os->lines + 1) * sizeof(RD_POINT));
695          y = os->y;  
696            points[0].x = os->x;
697            points[0].y = os->y;
698          pen.style = pen.width = 0;          pen.style = pen.width = 0;
699          pen.colour = os->fgcolour;          pen.colour = os->fgcolour;
700    
701          index = 0;          index = 0;
702          data = ((os->lines - 1) / 4) + 1;          data = ((os->lines - 1) / 4) + 1;
703          for (line = 0; (line < os->lines) && (data < os->datasize); line++)          for (next = 1; (next <= os->lines) && (data < os->datasize); next++)
704          {          {
705                  xfrom = x;                  if ((next - 1) % 4 == 0)
                 yfrom = y;  
   
                 if (line % 4 == 0)  
706                          flags = os->data[index++];                          flags = os->data[index++];
707    
708                  if ((flags & 0xc0) == 0)                  if (~flags & 0x80)
709                          flags |= 0xc0;  /* none = both */                          points[next].x = parse_delta(os->data, &data);
   
                 if (flags & 0x40)  
                         x += parse_delta(os->data, &data);  
   
                 if (flags & 0x80)  
                         y += parse_delta(os->data, &data);  
710    
711                  ui_line(opcode, xfrom, yfrom, x, y, &pen);                  if (~flags & 0x40)
712                            points[next].y = parse_delta(os->data, &data);
713    
714                  flags <<= 2;                  flags <<= 2;
715          }          }
716    
717            if (next - 1 == os->lines)
718                    ui_polyline(os->opcode - 1, points, os->lines + 1, &pen);
719            else
720                    error("polyline parse error\n");
721    
722            xfree(points);
723  }  }
724    
725  /* Process an ellipse order */  /* Process an ellipse order */
# Line 805  process_text2(STREAM s, TEXT2_ORDER * os Line 805  process_text2(STREAM s, TEXT2_ORDER * os
805                  in_uint8(s, os->flags);                  in_uint8(s, os->flags);
806    
807          if (present & 0x000004)          if (present & 0x000004)
808                  in_uint8(s, os->unknown);                  in_uint8(s, os->opcode);
809    
810          if (present & 0x000008)          if (present & 0x000008)
811                  in_uint8(s, os->mixmode);                  in_uint8(s, os->mixmode);
# Line 840  process_text2(STREAM s, TEXT2_ORDER * os Line 840  process_text2(STREAM s, TEXT2_ORDER * os
840          if (present & 0x002000)          if (present & 0x002000)
841                  in_uint16_le(s, os->boxbottom);                  in_uint16_le(s, os->boxbottom);
842    
843          /*          rdp_parse_brush(s, &os->brush, present >> 14);
          * Unknown members, seen when connecting to a session that was disconnected with  
          * mstsc and with wintach's spreadsheet test.  
          */  
         if (present & 0x004000)  
                 in_uint8s(s, 1);  
   
         if (present & 0x008000)  
                 in_uint8s(s, 1);  
   
         if (present & 0x010000)  
         {  
                 in_uint8s(s, 1);        /* guessing the length here */  
                 warning("Unknown order state member (0x010000) in text2 order.\n");  
         }  
   
         if (present & 0x020000)  
                 in_uint8s(s, 4);  
   
         if (present & 0x040000)  
                 in_uint8s(s, 4);  
844    
845          if (present & 0x080000)          if (present & 0x080000)
846                  in_uint16_le(s, os->x);                  in_uint16_le(s, os->x);
# Line 874  process_text2(STREAM s, TEXT2_ORDER * os Line 854  process_text2(STREAM s, TEXT2_ORDER * os
854                  in_uint8a(s, os->text, os->length);                  in_uint8a(s, os->text, os->length);
855          }          }
856    
857          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,br=%d,bb=%d,bs=%d,bg=0x%x,fg=0x%x,font=%d,fl=0x%x,op=0x%x,mix=%d,n=%d)\n", os->x, os->y, os->clipleft, os->cliptop, os->clipright, os->clipbottom, os->boxleft, os->boxtop, os->boxright, os->boxbottom, os->brush.style, os->bgcolour, os->fgcolour, os->font, os->flags, os->opcode, os->mixmode, os->length));
858    
859          DEBUG(("Text: "));          DEBUG(("Text: "));
860    
# Line 883  process_text2(STREAM s, TEXT2_ORDER * os Line 863  process_text2(STREAM s, TEXT2_ORDER * os
863    
864          DEBUG(("\n"));          DEBUG(("\n"));
865    
866          ui_draw_text(os->font, os->flags, os->mixmode, os->x, os->y,          ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y,
867                       os->clipleft, os->cliptop,                       os->clipleft, os->cliptop, os->clipright - os->clipleft,
868                       os->clipright - os->clipleft,                       os->clipbottom - os->cliptop, os->boxleft, os->boxtop,
869                       os->clipbottom - os->cliptop,                       os->boxright - os->boxleft, os->boxbottom - os->boxtop,
870                       os->boxleft, os->boxtop,                       &os->brush, os->bgcolour, os->fgcolour, os->text, os->length);
                      os->boxright - os->boxleft,  
                      os->boxbottom - os->boxtop, os->bgcolour, os->fgcolour, os->text, os->length);  
871  }  }
872    
873  /* Process a raw bitmap cache order */  /* Process a raw bitmap cache order */
874  static void  static void
875  process_raw_bmpcache(STREAM s)  process_raw_bmpcache(STREAM s)
876  {  {
877          HBITMAP bitmap;          RD_HBITMAP bitmap;
878          uint16 cache_idx, bufsize;          uint16 cache_idx, bufsize;
879          uint8 cache_id, width, height, bpp, Bpp;          uint8 cache_id, width, height, bpp, Bpp;
880          uint8 *data, *inverted;          uint8 *data, *inverted;
# Line 929  process_raw_bmpcache(STREAM s) Line 907  process_raw_bmpcache(STREAM s)
907  static void  static void
908  process_bmpcache(STREAM s)  process_bmpcache(STREAM s)
909  {  {
910          HBITMAP bitmap;          RD_HBITMAP bitmap;
911          uint16 cache_idx, size;          uint16 cache_idx, size;
912          uint8 cache_id, width, height, bpp, Bpp;          uint8 cache_id, width, height, bpp, Bpp;
913          uint8 *data, *bmpdata;          uint8 *data, *bmpdata;
# Line 985  process_bmpcache(STREAM s) Line 963  process_bmpcache(STREAM s)
963  static void  static void
964  process_bmpcache2(STREAM s, uint16 flags, BOOL compressed)  process_bmpcache2(STREAM s, uint16 flags, BOOL compressed)
965  {  {
966          HBITMAP bitmap;          RD_HBITMAP bitmap;
967          int y;          int y;
968          uint8 cache_id, cache_idx_low, width, height, Bpp;          uint8 cache_id, cache_idx_low, width, height, Bpp;
969          uint16 cache_idx, bufsize;          uint16 cache_idx, bufsize;
# Line 1067  process_colcache(STREAM s) Line 1045  process_colcache(STREAM s)
1045  {  {
1046          COLOURENTRY *entry;          COLOURENTRY *entry;
1047          COLOURMAP map;          COLOURMAP map;
1048          HCOLOURMAP hmap;          RD_HCOLOURMAP hmap;
1049          uint8 cache_id;          uint8 cache_id;
1050          int i;          int i;
1051    
# Line 1088  process_colcache(STREAM s) Line 1066  process_colcache(STREAM s)
1066          DEBUG(("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours));          DEBUG(("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours));
1067    
1068          hmap = ui_create_colourmap(&map);          hmap = ui_create_colourmap(&map);
1069          ui_set_colourmap(hmap);  
1070            if (cache_id)
1071                    ui_set_colourmap(hmap);
1072    
1073          xfree(map.colours);          xfree(map.colours);
1074  }  }
# Line 1097  process_colcache(STREAM s) Line 1077  process_colcache(STREAM s)
1077  static void  static void
1078  process_fontcache(STREAM s)  process_fontcache(STREAM s)
1079  {  {
1080          HGLYPH bitmap;          RD_HGLYPH bitmap;
1081          uint8 font, nglyphs;          uint8 font, nglyphs;
1082          uint16 character, offset, baseline, width, height;          uint16 character, offset, baseline, width, height;
1083          int i, datasize;          int i, datasize;

Legend:
Removed from v.831  
changed lines
  Added in v.1365

  ViewVC Help
Powered by ViewVC 1.1.26