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-2008 |
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 |
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 |
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 |
|
|
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; |
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) |
148 |
return s_check(s); |
return s_check(s); |
149 |
} |
} |
150 |
|
|
151 |
|
static void |
152 |
|
setup_brush(BRUSH * out_brush, BRUSH * in_brush) |
153 |
|
{ |
154 |
|
BRUSHDATA *brush_data; |
155 |
|
uint8 cache_idx; |
156 |
|
uint8 colour_code; |
157 |
|
|
158 |
|
memcpy(out_brush, in_brush, sizeof(BRUSH)); |
159 |
|
if (out_brush->style & 0x80) |
160 |
|
{ |
161 |
|
colour_code = out_brush->style & 0x0f; |
162 |
|
cache_idx = out_brush->pattern[0]; |
163 |
|
brush_data = cache_get_brush_data(colour_code, cache_idx); |
164 |
|
if ((brush_data == NULL) || (brush_data->data == NULL)) |
165 |
|
{ |
166 |
|
error("error getting brush data, style %x\n", out_brush->style); |
167 |
|
out_brush->bd = NULL; |
168 |
|
memset(out_brush->pattern, 0, 8); |
169 |
|
} |
170 |
|
else |
171 |
|
{ |
172 |
|
out_brush->bd = brush_data; |
173 |
|
} |
174 |
|
out_brush->style = 3; |
175 |
|
} |
176 |
|
} |
177 |
|
|
178 |
/* Parse a brush */ |
/* Parse a brush */ |
179 |
static BOOL |
static RD_BOOL |
180 |
rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present) |
rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present) |
181 |
{ |
{ |
182 |
if (present & 1) |
if (present & 1) |
199 |
|
|
200 |
/* Process a destination blt order */ |
/* Process a destination blt order */ |
201 |
static void |
static void |
202 |
process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, BOOL delta) |
process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, RD_BOOL delta) |
203 |
{ |
{ |
204 |
if (present & 0x01) |
if (present & 0x01) |
205 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
224 |
|
|
225 |
/* Process a pattern blt order */ |
/* Process a pattern blt order */ |
226 |
static void |
static void |
227 |
process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, BOOL delta) |
process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta) |
228 |
{ |
{ |
229 |
|
BRUSH brush; |
230 |
|
|
231 |
if (present & 0x0001) |
if (present & 0x0001) |
232 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
233 |
|
|
254 |
DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x, |
DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x, |
255 |
os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour)); |
os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour)); |
256 |
|
|
257 |
|
setup_brush(&brush, &os->brush); |
258 |
|
|
259 |
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, |
260 |
&os->brush, os->bgcolour, os->fgcolour); |
&brush, os->bgcolour, os->fgcolour); |
261 |
} |
} |
262 |
|
|
263 |
/* Process a screen blt order */ |
/* Process a screen blt order */ |
264 |
static void |
static void |
265 |
process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, BOOL delta) |
process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, RD_BOOL delta) |
266 |
{ |
{ |
267 |
if (present & 0x0001) |
if (present & 0x0001) |
268 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
293 |
|
|
294 |
/* Process a line order */ |
/* Process a line order */ |
295 |
static void |
static void |
296 |
process_line(STREAM s, LINE_ORDER * os, uint32 present, BOOL delta) |
process_line(STREAM s, LINE_ORDER * os, uint32 present, RD_BOOL delta) |
297 |
{ |
{ |
298 |
if (present & 0x0001) |
if (present & 0x0001) |
299 |
in_uint16_le(s, os->mixmode); |
in_uint16_le(s, os->mixmode); |
332 |
|
|
333 |
/* Process an opaque rectangle order */ |
/* Process an opaque rectangle order */ |
334 |
static void |
static void |
335 |
process_rect(STREAM s, RECT_ORDER * os, uint32 present, BOOL delta) |
process_rect(STREAM s, RECT_ORDER * os, uint32 present, RD_BOOL delta) |
336 |
{ |
{ |
337 |
uint32 i; |
uint32 i; |
338 |
if (present & 0x01) |
if (present & 0x01) |
372 |
|
|
373 |
/* Process a desktop save order */ |
/* Process a desktop save order */ |
374 |
static void |
static void |
375 |
process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, BOOL delta) |
process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, RD_BOOL delta) |
376 |
{ |
{ |
377 |
int width, height; |
int width, height; |
378 |
|
|
408 |
|
|
409 |
/* Process a memory blt order */ |
/* Process a memory blt order */ |
410 |
static void |
static void |
411 |
process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta) |
process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, RD_BOOL delta) |
412 |
{ |
{ |
413 |
HBITMAP bitmap; |
RD_HBITMAP bitmap; |
414 |
|
|
415 |
if (present & 0x0001) |
if (present & 0x0001) |
416 |
{ |
{ |
454 |
|
|
455 |
/* Process a 3-way blt order */ |
/* Process a 3-way blt order */ |
456 |
static void |
static void |
457 |
process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, BOOL delta) |
process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta) |
458 |
{ |
{ |
459 |
HBITMAP bitmap; |
RD_HBITMAP bitmap; |
460 |
|
BRUSH brush; |
461 |
|
|
462 |
if (present & 0x000001) |
if (present & 0x000001) |
463 |
{ |
{ |
508 |
if (bitmap == NULL) |
if (bitmap == NULL) |
509 |
return; |
return; |
510 |
|
|
511 |
|
setup_brush(&brush, &os->brush); |
512 |
|
|
513 |
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, |
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, |
514 |
bitmap, os->srcx, os->srcy, &os->brush, os->bgcolour, os->fgcolour); |
bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour); |
515 |
} |
} |
516 |
|
|
517 |
/* Process a polygon order */ |
/* Process a polygon order */ |
518 |
static void |
static void |
519 |
process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, BOOL delta) |
process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, RD_BOOL delta) |
520 |
{ |
{ |
521 |
int index, data, next; |
int index, data, next; |
522 |
uint8 flags = 0; |
uint8 flags = 0; |
523 |
POINT *points; |
RD_POINT *points; |
524 |
|
|
525 |
if (present & 0x01) |
if (present & 0x01) |
526 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
562 |
return; |
return; |
563 |
} |
} |
564 |
|
|
565 |
points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT)); |
points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT)); |
566 |
memset(points, 0, (os->npoints + 1) * sizeof(POINT)); |
memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT)); |
567 |
|
|
568 |
points[0].x = os->x; |
points[0].x = os->x; |
569 |
points[0].y = os->y; |
points[0].y = os->y; |
595 |
|
|
596 |
/* Process a polygon2 order */ |
/* Process a polygon2 order */ |
597 |
static void |
static void |
598 |
process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta) |
process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta) |
599 |
{ |
{ |
600 |
int index, data, next; |
int index, data, next; |
601 |
uint8 flags = 0; |
uint8 flags = 0; |
602 |
POINT *points; |
RD_POINT *points; |
603 |
|
BRUSH brush; |
604 |
|
|
605 |
if (present & 0x0001) |
if (present & 0x0001) |
606 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
648 |
return; |
return; |
649 |
} |
} |
650 |
|
|
651 |
points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT)); |
setup_brush(&brush, &os->brush); |
652 |
memset(points, 0, (os->npoints + 1) * sizeof(POINT)); |
|
653 |
|
points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT)); |
654 |
|
memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT)); |
655 |
|
|
656 |
points[0].x = os->x; |
points[0].x = os->x; |
657 |
points[0].y = os->y; |
points[0].y = os->y; |
674 |
|
|
675 |
if (next - 1 == os->npoints) |
if (next - 1 == os->npoints) |
676 |
ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1, |
ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1, |
677 |
&os->brush, os->bgcolour, os->fgcolour); |
&brush, os->bgcolour, os->fgcolour); |
678 |
else |
else |
679 |
error("polygon2 parse error\n"); |
error("polygon2 parse error\n"); |
680 |
|
|
683 |
|
|
684 |
/* Process a polyline order */ |
/* Process a polyline order */ |
685 |
static void |
static void |
686 |
process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta) |
process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, RD_BOOL delta) |
687 |
{ |
{ |
688 |
int index, next, data; |
int index, next, data; |
689 |
uint8 flags = 0; |
uint8 flags = 0; |
690 |
PEN pen; |
PEN pen; |
691 |
POINT *points; |
RD_POINT *points; |
692 |
|
|
693 |
if (present & 0x01) |
if (present & 0x01) |
694 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
727 |
return; |
return; |
728 |
} |
} |
729 |
|
|
730 |
points = (POINT *) xmalloc((os->lines + 1) * sizeof(POINT)); |
points = (RD_POINT *) xmalloc((os->lines + 1) * sizeof(RD_POINT)); |
731 |
memset(points, 0, (os->lines + 1) * sizeof(POINT)); |
memset(points, 0, (os->lines + 1) * sizeof(RD_POINT)); |
732 |
|
|
733 |
points[0].x = os->x; |
points[0].x = os->x; |
734 |
points[0].y = os->y; |
points[0].y = os->y; |
735 |
|
pen.style = pen.width = 0; |
736 |
|
pen.colour = os->fgcolour; |
737 |
|
|
738 |
index = 0; |
index = 0; |
739 |
data = ((os->lines - 1) / 4) + 1; |
data = ((os->lines - 1) / 4) + 1; |
740 |
for (next = 1; (next < os->lines) && (data < os->datasize); next++) |
for (next = 1; (next <= os->lines) && (data < os->datasize); next++) |
741 |
{ |
{ |
742 |
if ((next - 1) % 4 == 0) |
if ((next - 1) % 4 == 0) |
743 |
flags = os->data[index++]; |
flags = os->data[index++]; |
755 |
ui_polyline(os->opcode - 1, points, os->lines + 1, &pen); |
ui_polyline(os->opcode - 1, points, os->lines + 1, &pen); |
756 |
else |
else |
757 |
error("polyline parse error\n"); |
error("polyline parse error\n"); |
758 |
|
|
759 |
|
xfree(points); |
760 |
} |
} |
761 |
|
|
762 |
/* Process an ellipse order */ |
/* Process an ellipse order */ |
763 |
static void |
static void |
764 |
process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, BOOL delta) |
process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, RD_BOOL delta) |
765 |
{ |
{ |
766 |
if (present & 0x01) |
if (present & 0x01) |
767 |
rdp_in_coord(s, &os->left, delta); |
rdp_in_coord(s, &os->left, delta); |
793 |
|
|
794 |
/* Process an ellipse2 order */ |
/* Process an ellipse2 order */ |
795 |
static void |
static void |
796 |
process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, BOOL delta) |
process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta) |
797 |
{ |
{ |
798 |
|
BRUSH brush; |
799 |
|
|
800 |
if (present & 0x0001) |
if (present & 0x0001) |
801 |
rdp_in_coord(s, &os->left, delta); |
rdp_in_coord(s, &os->left, delta); |
802 |
|
|
827 |
os->left, os->top, os->right, os->bottom, os->opcode, os->fillmode, os->brush.style, |
os->left, os->top, os->right, os->bottom, os->opcode, os->fillmode, os->brush.style, |
828 |
os->bgcolour, os->fgcolour)); |
os->bgcolour, os->fgcolour)); |
829 |
|
|
830 |
|
setup_brush(&brush, &os->brush); |
831 |
|
|
832 |
ui_ellipse(os->opcode - 1, os->fillmode, os->left, os->top, os->right - os->left, |
ui_ellipse(os->opcode - 1, os->fillmode, os->left, os->top, os->right - os->left, |
833 |
os->bottom - os->top, &os->brush, os->bgcolour, os->fgcolour); |
os->bottom - os->top, &brush, os->bgcolour, os->fgcolour); |
834 |
} |
} |
835 |
|
|
836 |
/* Process a text order */ |
/* Process a text order */ |
837 |
static void |
static void |
838 |
process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, BOOL delta) |
process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta) |
839 |
{ |
{ |
840 |
int i; |
int i; |
841 |
|
BRUSH brush; |
842 |
|
|
843 |
if (present & 0x000001) |
if (present & 0x000001) |
844 |
in_uint8(s, os->font); |
in_uint8(s, os->font); |
905 |
|
|
906 |
DEBUG(("\n")); |
DEBUG(("\n")); |
907 |
|
|
908 |
|
setup_brush(&brush, &os->brush); |
909 |
|
|
910 |
ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y, |
ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y, |
911 |
os->clipleft, os->cliptop, os->clipright - os->clipleft, |
os->clipleft, os->cliptop, os->clipright - os->clipleft, |
912 |
os->clipbottom - os->cliptop, os->boxleft, os->boxtop, |
os->clipbottom - os->cliptop, os->boxleft, os->boxtop, |
913 |
os->boxright - os->boxleft, os->boxbottom - os->boxtop, |
os->boxright - os->boxleft, os->boxbottom - os->boxtop, |
914 |
&os->brush, os->bgcolour, os->fgcolour, os->text, os->length); |
&brush, os->bgcolour, os->fgcolour, os->text, os->length); |
915 |
} |
} |
916 |
|
|
917 |
/* Process a raw bitmap cache order */ |
/* Process a raw bitmap cache order */ |
918 |
static void |
static void |
919 |
process_raw_bmpcache(STREAM s) |
process_raw_bmpcache(STREAM s) |
920 |
{ |
{ |
921 |
HBITMAP bitmap; |
RD_HBITMAP bitmap; |
922 |
uint16 cache_idx, bufsize; |
uint16 cache_idx, bufsize; |
923 |
uint8 cache_id, width, height, bpp, Bpp; |
uint8 cache_id, width, height, bpp, Bpp; |
924 |
uint8 *data, *inverted; |
uint8 *data, *inverted; |
951 |
static void |
static void |
952 |
process_bmpcache(STREAM s) |
process_bmpcache(STREAM s) |
953 |
{ |
{ |
954 |
HBITMAP bitmap; |
RD_HBITMAP bitmap; |
955 |
uint16 cache_idx, size; |
uint16 cache_idx, size; |
956 |
uint8 cache_id, width, height, bpp, Bpp; |
uint8 cache_id, width, height, bpp, Bpp; |
957 |
uint8 *data, *bmpdata; |
uint8 *data, *bmpdata; |
1005 |
|
|
1006 |
/* Process a bitmap cache v2 order */ |
/* Process a bitmap cache v2 order */ |
1007 |
static void |
static void |
1008 |
process_bmpcache2(STREAM s, uint16 flags, BOOL compressed) |
process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed) |
1009 |
{ |
{ |
1010 |
HBITMAP bitmap; |
RD_HBITMAP bitmap; |
1011 |
int y; |
int y; |
1012 |
uint8 cache_id, cache_idx_low, width, height, Bpp; |
uint8 cache_id, cache_idx_low, width, height, Bpp; |
1013 |
uint16 cache_idx, bufsize; |
uint16 cache_idx, bufsize; |
1089 |
{ |
{ |
1090 |
COLOURENTRY *entry; |
COLOURENTRY *entry; |
1091 |
COLOURMAP map; |
COLOURMAP map; |
1092 |
HCOLOURMAP hmap; |
RD_HCOLOURMAP hmap; |
1093 |
uint8 cache_id; |
uint8 cache_id; |
1094 |
int i; |
int i; |
1095 |
|
|
1110 |
DEBUG(("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours)); |
DEBUG(("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours)); |
1111 |
|
|
1112 |
hmap = ui_create_colourmap(&map); |
hmap = ui_create_colourmap(&map); |
1113 |
ui_set_colourmap(hmap); |
|
1114 |
|
if (cache_id) |
1115 |
|
ui_set_colourmap(hmap); |
1116 |
|
|
1117 |
xfree(map.colours); |
xfree(map.colours); |
1118 |
} |
} |
1121 |
static void |
static void |
1122 |
process_fontcache(STREAM s) |
process_fontcache(STREAM s) |
1123 |
{ |
{ |
1124 |
HGLYPH bitmap; |
RD_HGLYPH bitmap; |
1125 |
uint8 font, nglyphs; |
uint8 font, nglyphs; |
1126 |
uint16 character, offset, baseline, width, height; |
uint16 character, offset, baseline, width, height; |
1127 |
int i, datasize; |
int i, datasize; |
1148 |
} |
} |
1149 |
} |
} |
1150 |
|
|
1151 |
|
static void |
1152 |
|
process_compressed_8x8_brush_data(uint8 * in, uint8 * out, int Bpp) |
1153 |
|
{ |
1154 |
|
int x, y, pal_index, in_index, shift, do2, i; |
1155 |
|
uint8 *pal; |
1156 |
|
|
1157 |
|
in_index = 0; |
1158 |
|
pal = in + 16; |
1159 |
|
/* read it bottom up */ |
1160 |
|
for (y = 7; y >= 0; y--) |
1161 |
|
{ |
1162 |
|
/* 2 bytes per row */ |
1163 |
|
x = 0; |
1164 |
|
for (do2 = 0; do2 < 2; do2++) |
1165 |
|
{ |
1166 |
|
/* 4 pixels per byte */ |
1167 |
|
shift = 6; |
1168 |
|
while (shift >= 0) |
1169 |
|
{ |
1170 |
|
pal_index = (in[in_index] >> shift) & 3; |
1171 |
|
/* size of palette entries depends on Bpp */ |
1172 |
|
for (i = 0; i < Bpp; i++) |
1173 |
|
{ |
1174 |
|
out[(y * 8 + x) * Bpp + i] = pal[pal_index * Bpp + i]; |
1175 |
|
} |
1176 |
|
x++; |
1177 |
|
shift -= 2; |
1178 |
|
} |
1179 |
|
in_index++; |
1180 |
|
} |
1181 |
|
} |
1182 |
|
} |
1183 |
|
|
1184 |
|
/* Process a brush cache order */ |
1185 |
|
static void |
1186 |
|
process_brushcache(STREAM s, uint16 flags) |
1187 |
|
{ |
1188 |
|
BRUSHDATA brush_data; |
1189 |
|
uint8 cache_idx, colour_code, width, height, size, type; |
1190 |
|
uint8 *comp_brush; |
1191 |
|
int index; |
1192 |
|
int Bpp; |
1193 |
|
|
1194 |
|
in_uint8(s, cache_idx); |
1195 |
|
in_uint8(s, colour_code); |
1196 |
|
in_uint8(s, width); |
1197 |
|
in_uint8(s, height); |
1198 |
|
in_uint8(s, type); /* type, 0x8x = cached */ |
1199 |
|
in_uint8(s, size); |
1200 |
|
|
1201 |
|
DEBUG(("BRUSHCACHE(idx=%d,dp=%d,wd=%d,ht=%d,sz=%d)\n", cache_idx, depth, |
1202 |
|
width, height, size)); |
1203 |
|
|
1204 |
|
if ((width == 8) && (height == 8)) |
1205 |
|
{ |
1206 |
|
if (colour_code == 1) |
1207 |
|
{ |
1208 |
|
brush_data.colour_code = 1; |
1209 |
|
brush_data.data_size = 8; |
1210 |
|
brush_data.data = xmalloc(8); |
1211 |
|
if (size == 8) |
1212 |
|
{ |
1213 |
|
/* read it bottom up */ |
1214 |
|
for (index = 7; index >= 0; index--) |
1215 |
|
{ |
1216 |
|
in_uint8(s, brush_data.data[index]); |
1217 |
|
} |
1218 |
|
} |
1219 |
|
else |
1220 |
|
{ |
1221 |
|
warning("incompatible brush, colour_code %d size %d\n", colour_code, |
1222 |
|
size); |
1223 |
|
} |
1224 |
|
cache_put_brush_data(1, cache_idx, &brush_data); |
1225 |
|
} |
1226 |
|
else if ((colour_code >= 3) && (colour_code <= 6)) |
1227 |
|
{ |
1228 |
|
Bpp = colour_code - 2; |
1229 |
|
brush_data.colour_code = colour_code; |
1230 |
|
brush_data.data_size = 8 * 8 * Bpp; |
1231 |
|
brush_data.data = xmalloc(8 * 8 * Bpp); |
1232 |
|
if (size == 16 + 4 * Bpp) |
1233 |
|
{ |
1234 |
|
in_uint8p(s, comp_brush, 16 + 4 * Bpp); |
1235 |
|
process_compressed_8x8_brush_data(comp_brush, brush_data.data, Bpp); |
1236 |
|
} |
1237 |
|
else |
1238 |
|
{ |
1239 |
|
in_uint8a(s, brush_data.data, 8 * 8 * Bpp); |
1240 |
|
} |
1241 |
|
cache_put_brush_data(colour_code, cache_idx, &brush_data); |
1242 |
|
} |
1243 |
|
else |
1244 |
|
{ |
1245 |
|
warning("incompatible brush, colour_code %d size %d\n", colour_code, size); |
1246 |
|
} |
1247 |
|
} |
1248 |
|
else |
1249 |
|
{ |
1250 |
|
warning("incompatible brush, width height %d %d\n", width, height); |
1251 |
|
} |
1252 |
|
} |
1253 |
|
|
1254 |
/* Process a secondary order */ |
/* Process a secondary order */ |
1255 |
static void |
static void |
1256 |
process_secondary_order(STREAM s) |
process_secondary_order(STREAM s) |
1295 |
process_bmpcache2(s, flags, True); /* compressed */ |
process_bmpcache2(s, flags, True); /* compressed */ |
1296 |
break; |
break; |
1297 |
|
|
1298 |
|
case RDP_ORDER_BRUSHCACHE: |
1299 |
|
process_brushcache(s, flags); |
1300 |
|
break; |
1301 |
|
|
1302 |
default: |
default: |
1303 |
unimpl("secondary order %d\n", type); |
unimpl("secondary order %d\n", type); |
1304 |
} |
} |
1314 |
uint32 present; |
uint32 present; |
1315 |
uint8 order_flags; |
uint8 order_flags; |
1316 |
int size, processed = 0; |
int size, processed = 0; |
1317 |
BOOL delta; |
RD_BOOL delta; |
1318 |
|
|
1319 |
while (processed < num_orders) |
while (processed < num_orders) |
1320 |
{ |
{ |