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 |
|
uint16 cache_idx; |
156 |
|
uint8 brush_bpp; |
157 |
|
|
158 |
|
memcpy(out_brush, in_brush, sizeof(BRUSH)); |
159 |
|
if (out_brush->style & 0x80) |
160 |
|
{ |
161 |
|
brush_bpp = out_brush->style & 0x0f; |
162 |
|
if (brush_bpp == 1) /* 1 bpp */ |
163 |
|
{ |
164 |
|
cache_idx = out_brush->pattern[0]; |
165 |
|
brush_data = cache_get_brush_data(cache_idx); |
166 |
|
if (brush_data == NULL) |
167 |
|
{ |
168 |
|
error("error getting brush data, style %x\n", out_brush->style); |
169 |
|
} |
170 |
|
else |
171 |
|
{ |
172 |
|
memcpy(out_brush->pattern, brush_data->pattern, |
173 |
|
sizeof(out_brush->pattern)); |
174 |
|
} |
175 |
|
} |
176 |
|
else |
177 |
|
{ |
178 |
|
error("bad brush bpp %d\n", brush_bpp); |
179 |
|
} |
180 |
|
out_brush->style = 3; |
181 |
|
} |
182 |
|
} |
183 |
|
|
184 |
/* Parse a brush */ |
/* Parse a brush */ |
185 |
static RD_BOOL |
static RD_BOOL |
186 |
rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present) |
rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present) |
232 |
static void |
static void |
233 |
process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta) |
process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta) |
234 |
{ |
{ |
235 |
|
BRUSH brush; |
236 |
|
|
237 |
if (present & 0x0001) |
if (present & 0x0001) |
238 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
239 |
|
|
260 |
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, |
261 |
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)); |
262 |
|
|
263 |
|
setup_brush(&brush, &os->brush); |
264 |
|
|
265 |
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, |
266 |
&os->brush, os->bgcolour, os->fgcolour); |
&brush, os->bgcolour, os->fgcolour); |
267 |
} |
} |
268 |
|
|
269 |
/* Process a screen blt order */ |
/* Process a screen blt order */ |
463 |
process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta) |
process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta) |
464 |
{ |
{ |
465 |
RD_HBITMAP bitmap; |
RD_HBITMAP bitmap; |
466 |
|
BRUSH brush; |
467 |
|
|
468 |
if (present & 0x000001) |
if (present & 0x000001) |
469 |
{ |
{ |
514 |
if (bitmap == NULL) |
if (bitmap == NULL) |
515 |
return; |
return; |
516 |
|
|
517 |
|
setup_brush(&brush, &os->brush); |
518 |
|
|
519 |
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, |
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, |
520 |
bitmap, os->srcx, os->srcy, &os->brush, os->bgcolour, os->fgcolour); |
bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour); |
521 |
} |
} |
522 |
|
|
523 |
/* Process a polygon order */ |
/* Process a polygon order */ |
606 |
int index, data, next; |
int index, data, next; |
607 |
uint8 flags = 0; |
uint8 flags = 0; |
608 |
RD_POINT *points; |
RD_POINT *points; |
609 |
|
BRUSH brush; |
610 |
|
|
611 |
if (present & 0x0001) |
if (present & 0x0001) |
612 |
rdp_in_coord(s, &os->x, delta); |
rdp_in_coord(s, &os->x, delta); |
654 |
return; |
return; |
655 |
} |
} |
656 |
|
|
657 |
|
setup_brush(&brush, &os->brush); |
658 |
|
|
659 |
points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT)); |
points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT)); |
660 |
memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT)); |
memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT)); |
661 |
|
|
680 |
|
|
681 |
if (next - 1 == os->npoints) |
if (next - 1 == os->npoints) |
682 |
ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1, |
ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1, |
683 |
&os->brush, os->bgcolour, os->fgcolour); |
&brush, os->bgcolour, os->fgcolour); |
684 |
else |
else |
685 |
error("polygon2 parse error\n"); |
error("polygon2 parse error\n"); |
686 |
|
|
801 |
static void |
static void |
802 |
process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta) |
process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta) |
803 |
{ |
{ |
804 |
|
BRUSH brush; |
805 |
|
|
806 |
if (present & 0x0001) |
if (present & 0x0001) |
807 |
rdp_in_coord(s, &os->left, delta); |
rdp_in_coord(s, &os->left, delta); |
808 |
|
|
833 |
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, |
834 |
os->bgcolour, os->fgcolour)); |
os->bgcolour, os->fgcolour)); |
835 |
|
|
836 |
|
setup_brush(&brush, &os->brush); |
837 |
|
|
838 |
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, |
839 |
os->bottom - os->top, &os->brush, os->bgcolour, os->fgcolour); |
os->bottom - os->top, &brush, os->bgcolour, os->fgcolour); |
840 |
} |
} |
841 |
|
|
842 |
/* Process a text order */ |
/* Process a text order */ |
844 |
process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta) |
process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta) |
845 |
{ |
{ |
846 |
int i; |
int i; |
847 |
|
BRUSH brush; |
848 |
|
|
849 |
if (present & 0x000001) |
if (present & 0x000001) |
850 |
in_uint8(s, os->font); |
in_uint8(s, os->font); |
911 |
|
|
912 |
DEBUG(("\n")); |
DEBUG(("\n")); |
913 |
|
|
914 |
|
setup_brush(&brush, &os->brush); |
915 |
|
|
916 |
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, |
917 |
os->clipleft, os->cliptop, os->clipright - os->clipleft, |
os->clipleft, os->cliptop, os->clipright - os->clipleft, |
918 |
os->clipbottom - os->cliptop, os->boxleft, os->boxtop, |
os->clipbottom - os->cliptop, os->boxleft, os->boxtop, |
919 |
os->boxright - os->boxleft, os->boxbottom - os->boxtop, |
os->boxright - os->boxleft, os->boxbottom - os->boxtop, |
920 |
&os->brush, os->bgcolour, os->fgcolour, os->text, os->length); |
&brush, os->bgcolour, os->fgcolour, os->text, os->length); |
921 |
} |
} |
922 |
|
|
923 |
/* Process a raw bitmap cache order */ |
/* Process a raw bitmap cache order */ |
1154 |
} |
} |
1155 |
} |
} |
1156 |
|
|
1157 |
|
/* Process a brush cache order */ |
1158 |
|
static void |
1159 |
|
process_brushcache(STREAM s, uint16 flags) |
1160 |
|
{ |
1161 |
|
BRUSHDATA brush_data; |
1162 |
|
uint8 cache_idx, depth, width, height, size; |
1163 |
|
|
1164 |
|
in_uint8(s, cache_idx); |
1165 |
|
in_uint8(s, depth); |
1166 |
|
in_uint8(s, width); |
1167 |
|
in_uint8(s, height); |
1168 |
|
in_uint8s(s, 1); /* type, 0x80 = cached */ |
1169 |
|
in_uint8(s, size); |
1170 |
|
|
1171 |
|
DEBUG(("BRUSHCACHE(idx=%d,dp=%d,wd=%d,ht=%d,sz=%d)\n", cache_idx, depth, |
1172 |
|
width, height, size)); |
1173 |
|
|
1174 |
|
if ((depth == 1) && (width == 8) && (height == 8) && (size == 8)) |
1175 |
|
{ |
1176 |
|
in_uint8a(s, brush_data.pattern, sizeof(brush_data.pattern)); |
1177 |
|
cache_put_brush_data(cache_idx, &brush_data); |
1178 |
|
} |
1179 |
|
else |
1180 |
|
{ |
1181 |
|
warning("ignoring incompatible brush type. display may be incorrect\n"); |
1182 |
|
} |
1183 |
|
} |
1184 |
|
|
1185 |
/* Process a secondary order */ |
/* Process a secondary order */ |
1186 |
static void |
static void |
1187 |
process_secondary_order(STREAM s) |
process_secondary_order(STREAM s) |
1226 |
process_bmpcache2(s, flags, True); /* compressed */ |
process_bmpcache2(s, flags, True); /* compressed */ |
1227 |
break; |
break; |
1228 |
|
|
1229 |
|
case RDP_ORDER_BRUSHCACHE: |
1230 |
|
process_brushcache(s, flags); |
1231 |
|
break; |
1232 |
|
|
1233 |
default: |
default: |
1234 |
unimpl("secondary order %d\n", type); |
unimpl("secondary order %d\n", type); |
1235 |
} |
} |