/[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 846 by jdmeijer, Fri Mar 11 00:50:19 2005 UTC revision 1372 by jsorg71, Mon Jan 8 04:47:06 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 23  Line 23 
23    
24  extern uint8 *g_next_packet;  extern uint8 *g_next_packet;
25  static RDP_ORDER_STATE g_order_state;  static RDP_ORDER_STATE g_order_state;
26  extern BOOL g_use_rdp5;  extern RD_BOOL g_use_rdp5;
27    
28  /* Read field indicating which parameters are present */  /* Read field indicating which parameters are present */
29  static void  static void
# Line 55  rdp_in_present(STREAM s, uint32 * presen Line 55  rdp_in_present(STREAM s, uint32 * presen
55    
56  /* Read a co-ordinate (16-bit, or 8-bit delta) */  /* Read a co-ordinate (16-bit, or 8-bit delta) */
57  static void  static void
58  rdp_in_coord(STREAM s, sint16 * coord, BOOL delta)  rdp_in_coord(STREAM s, sint16 * coord, RD_BOOL delta)
59  {  {
60          sint8 change;          sint8 change;
61    
# Line 102  rdp_in_colour(STREAM s, uint32 * colour) Line 102  rdp_in_colour(STREAM s, uint32 * colour)
102  }  }
103    
104  /* Parse bounds information */  /* Parse bounds information */
105  static BOOL  static RD_BOOL
106  rdp_parse_bounds(STREAM s, BOUNDS * bounds)  rdp_parse_bounds(STREAM s, BOUNDS * bounds)
107  {  {
108          uint8 present;          uint8 present;
# Line 133  rdp_parse_bounds(STREAM s, BOUNDS * boun Line 133  rdp_parse_bounds(STREAM s, BOUNDS * boun
133  }  }
134    
135  /* Parse a pen */  /* Parse a pen */
136  static BOOL  static RD_BOOL
137  rdp_parse_pen(STREAM s, PEN * pen, uint32 present)  rdp_parse_pen(STREAM s, PEN * pen, uint32 present)
138  {  {
139          if (present & 1)          if (present & 1)
# Line 149  rdp_parse_pen(STREAM s, PEN * pen, uint3 Line 149  rdp_parse_pen(STREAM s, PEN * pen, uint3
149  }  }
150    
151  /* Parse a brush */  /* Parse a brush */
152  static BOOL  static RD_BOOL
153  rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present)  rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present)
154  {  {
155          if (present & 1)          if (present & 1)
# Line 172  rdp_parse_brush(STREAM s, BRUSH * brush, Line 172  rdp_parse_brush(STREAM s, BRUSH * brush,
172    
173  /* Process a destination blt order */  /* Process a destination blt order */
174  static void  static void
175  process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, BOOL delta)  process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, RD_BOOL delta)
176  {  {
177          if (present & 0x01)          if (present & 0x01)
178                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 197  process_destblt(STREAM s, DESTBLT_ORDER Line 197  process_destblt(STREAM s, DESTBLT_ORDER
197    
198  /* Process a pattern blt order */  /* Process a pattern blt order */
199  static void  static void
200  process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, BOOL delta)  process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta)
201  {  {
202          if (present & 0x0001)          if (present & 0x0001)
203                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 231  process_patblt(STREAM s, PATBLT_ORDER * Line 231  process_patblt(STREAM s, PATBLT_ORDER *
231    
232  /* Process a screen blt order */  /* Process a screen blt order */
233  static void  static void
234  process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, BOOL delta)  process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, RD_BOOL delta)
235  {  {
236          if (present & 0x0001)          if (present & 0x0001)
237                  rdp_in_coord(s, &os->x, delta);                  rdp_in_coord(s, &os->x, delta);
# Line 262  process_screenblt(STREAM s, SCREENBLT_OR Line 262  process_screenblt(STREAM s, SCREENBLT_OR
262    
263  /* Process a line order */  /* Process a line order */
264  static void  static void
265  process_line(STREAM s, LINE_ORDER * os, uint32 present, BOOL delta)  process_line(STREAM s, LINE_ORDER * os, uint32 present, RD_BOOL delta)
266  {  {
267          if (present & 0x0001)          if (present & 0x0001)
268                  in_uint16_le(s, os->mixmode);                  in_uint16_le(s, os->mixmode);
# Line 301  process_line(STREAM s, LINE_ORDER * os, Line 301  process_line(STREAM s, LINE_ORDER * os,
301    
302  /* Process an opaque rectangle order */  /* Process an opaque rectangle order */
303  static void  static void
304  process_rect(STREAM s, RECT_ORDER * os, uint32 present, BOOL delta)  process_rect(STREAM s, RECT_ORDER * os, uint32 present, RD_BOOL delta)
305  {  {
306          uint32 i;          uint32 i;
307          if (present & 0x01)          if (present & 0x01)
# Line 341  process_rect(STREAM s, RECT_ORDER * os, Line 341  process_rect(STREAM s, RECT_ORDER * os,
341    
342  /* Process a desktop save order */  /* Process a desktop save order */
343  static void  static void
344  process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, BOOL delta)  process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, RD_BOOL delta)
345  {  {
346          int width, height;          int width, height;
347    
# Line 377  process_desksave(STREAM s, DESKSAVE_ORDE Line 377  process_desksave(STREAM s, DESKSAVE_ORDE
377    
378  /* Process a memory blt order */  /* Process a memory blt order */
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, RD_BOOL delta)
381  {  {
382          HBITMAP bitmap;          RD_HBITMAP bitmap;
383    
384          if (present & 0x0001)          if (present & 0x0001)
385          {          {
# Line 423  process_memblt(STREAM s, MEMBLT_ORDER * Line 423  process_memblt(STREAM s, MEMBLT_ORDER *
423    
424  /* Process a 3-way blt order */  /* Process a 3-way blt 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, RD_BOOL delta)
427  {  {
428          HBITMAP bitmap;          RD_HBITMAP bitmap;
429    
430          if (present & 0x000001)          if (present & 0x000001)
431          {          {
# Line 482  process_triblt(STREAM s, TRIBLT_ORDER * Line 482  process_triblt(STREAM s, TRIBLT_ORDER *
482    
483  /* Process a polygon order */  /* Process a polygon order */
484  static void  static void
485  process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, BOOL delta)  process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, RD_BOOL delta)
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 561  process_polygon(STREAM s, POLYGON_ORDER Line 561  process_polygon(STREAM s, POLYGON_ORDER
561    
562  /* Process a polygon2 order */  /* Process a polygon2 order */
563  static void  static void
564  process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta)  process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta)
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 646  process_polygon2(STREAM s, POLYGON2_ORDE Line 646  process_polygon2(STREAM s, POLYGON2_ORDE
646    
647  /* Process a polyline order */  /* Process a polyline order */
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, RD_BOOL delta)
650  {  {
651          int index, next, data;          int index, next, data;
652          uint8 flags = 0;          uint8 flags = 0;
653          PEN pen;          PEN pen;
654          POINT *points;          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 690  process_polyline(STREAM s, POLYLINE_ORDE Line 690  process_polyline(STREAM s, POLYLINE_ORDE
690                  return;                  return;
691          }          }
692    
693          points = (POINT *) xmalloc((os->lines + 1) * sizeof(POINT));          points = (RD_POINT *) xmalloc((os->lines + 1) * sizeof(RD_POINT));
694          memset(points, 0, (os->lines + 1) * sizeof(POINT));          memset(points, 0, (os->lines + 1) * sizeof(RD_POINT));
695    
696          points[0].x = os->x;          points[0].x = os->x;
697          points[0].y = os->y;          points[0].y = os->y;
# Line 724  process_polyline(STREAM s, POLYLINE_ORDE Line 724  process_polyline(STREAM s, POLYLINE_ORDE
724    
725  /* Process an ellipse order */  /* Process an ellipse order */
726  static void  static void
727  process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, BOOL delta)  process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, RD_BOOL delta)
728  {  {
729          if (present & 0x01)          if (present & 0x01)
730                  rdp_in_coord(s, &os->left, delta);                  rdp_in_coord(s, &os->left, delta);
# Line 756  process_ellipse(STREAM s, ELLIPSE_ORDER Line 756  process_ellipse(STREAM s, ELLIPSE_ORDER
756    
757  /* Process an ellipse2 order */  /* Process an ellipse2 order */
758  static void  static void
759  process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, BOOL delta)  process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta)
760  {  {
761          if (present & 0x0001)          if (present & 0x0001)
762                  rdp_in_coord(s, &os->left, delta);                  rdp_in_coord(s, &os->left, delta);
# Line 794  process_ellipse2(STREAM s, ELLIPSE2_ORDE Line 794  process_ellipse2(STREAM s, ELLIPSE2_ORDE
794    
795  /* Process a text order */  /* Process a text order */
796  static void  static void
797  process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, BOOL delta)  process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta)
798  {  {
799          int i;          int i;
800    
# Line 874  process_text2(STREAM s, TEXT2_ORDER * os Line 874  process_text2(STREAM s, TEXT2_ORDER * os
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 907  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 961  process_bmpcache(STREAM s) Line 961  process_bmpcache(STREAM s)
961    
962  /* Process a bitmap cache v2 order */  /* Process a bitmap cache v2 order */
963  static void  static void
964  process_bmpcache2(STREAM s, uint16 flags, BOOL compressed)  process_bmpcache2(STREAM s, uint16 flags, RD_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 1045  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 1066  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 1075  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;
# Line 1161  process_orders(STREAM s, uint16 num_orde Line 1163  process_orders(STREAM s, uint16 num_orde
1163          uint32 present;          uint32 present;
1164          uint8 order_flags;          uint8 order_flags;
1165          int size, processed = 0;          int size, processed = 0;
1166          BOOL delta;          RD_BOOL delta;
1167    
1168          while (processed < num_orders)          while (processed < num_orders)
1169          {          {

Legend:
Removed from v.846  
changed lines
  Added in v.1372

  ViewVC Help
Powered by ViewVC 1.1.26