441 |
&os->brush, os->bgcolour, os->fgcolour); |
&os->brush, os->bgcolour, os->fgcolour); |
442 |
} |
} |
443 |
|
|
444 |
|
/* Parse a delta co-ordinate in polyline order form */ |
445 |
|
static int parse_delta(uint8 *buffer, int *offset) |
446 |
|
{ |
447 |
|
int value = buffer[(*offset)++]; |
448 |
|
int two_byte = value & 0x80; |
449 |
|
|
450 |
|
if (value & 0x40) /* sign bit */ |
451 |
|
value |= ~0x3f; |
452 |
|
else |
453 |
|
value &= 0x3f; |
454 |
|
|
455 |
|
if (two_byte) |
456 |
|
value = (value << 8) | buffer[(*offset)++]; |
457 |
|
|
458 |
|
return value; |
459 |
|
} |
460 |
|
|
461 |
|
/* Process a polyline order */ |
462 |
|
static void process_polyline(STREAM s, POLYLINE_ORDER *os, |
463 |
|
uint32 present, BOOL delta) |
464 |
|
{ |
465 |
|
int index, line, data; |
466 |
|
int x, y, xfrom, yfrom; |
467 |
|
uint8 flags = 0; |
468 |
|
PEN pen; |
469 |
|
|
470 |
|
if (present & 0x01) |
471 |
|
rdp_in_coord(s, &os->x, delta); |
472 |
|
|
473 |
|
if (present & 0x02) |
474 |
|
rdp_in_coord(s, &os->y, delta); |
475 |
|
|
476 |
|
if (present & 0x04) |
477 |
|
in_uint8(s, os->flags); |
478 |
|
|
479 |
|
if (present & 0x10) |
480 |
|
rdp_in_colour(s, &os->fgcolour); |
481 |
|
|
482 |
|
if (present & 0x20) |
483 |
|
in_uint8(s, os->lines); |
484 |
|
|
485 |
|
if (present & 0x40) |
486 |
|
{ |
487 |
|
in_uint8(s, os->datasize); |
488 |
|
in_uint8a(s, os->data, os->datasize); |
489 |
|
} |
490 |
|
|
491 |
|
DEBUG("POLYLINE(x=%d,y=%d,fl=0x%x,fg=0x%x,n=%d,sz=%d)\n", |
492 |
|
os->x, os->y, os->flags, os->fgcolour, os->lines, os->datasize); |
493 |
|
|
494 |
|
DEBUG("Data: "); |
495 |
|
|
496 |
|
for (index = 0; index < os->datasize; index++) |
497 |
|
DEBUG("%02x ", os->data[index]); |
498 |
|
|
499 |
|
DEBUG("\n"); |
500 |
|
|
501 |
|
x = os->x; |
502 |
|
y = os->y; |
503 |
|
pen.style = pen.width = 0; |
504 |
|
pen.colour = os->fgcolour; |
505 |
|
|
506 |
|
index = 0; |
507 |
|
data = ((os->lines - 1) / 4) + 1; |
508 |
|
for (line = 0; (line < os->lines) && (data < os->datasize); line++) |
509 |
|
{ |
510 |
|
xfrom = x; |
511 |
|
yfrom = y; |
512 |
|
|
513 |
|
if (line % 4 == 0) |
514 |
|
flags = os->data[index++]; |
515 |
|
|
516 |
|
if ((flags & 0xc0) == 0) |
517 |
|
flags |= 0xc0; /* none = both */ |
518 |
|
|
519 |
|
if (flags & 0x40) |
520 |
|
x += parse_delta(os->data, &data); |
521 |
|
|
522 |
|
if (flags & 0x80) |
523 |
|
y += parse_delta(os->data, &data); |
524 |
|
|
525 |
|
ui_line(ROP2_COPY, xfrom, yfrom, x, y, &pen); |
526 |
|
|
527 |
|
flags <<= 2; |
528 |
|
} |
529 |
|
} |
530 |
|
|
531 |
/* Process a text order */ |
/* Process a text order */ |
532 |
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta) |
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta) |
533 |
{ |
{ |
602 |
DEBUG("\n"); |
DEBUG("\n"); |
603 |
|
|
604 |
/* Process special cache strings */ |
/* Process special cache strings */ |
605 |
if ((os->length == 2) && (os->text[0] == 0xfe)) |
if ((os->length >= 2) && (os->text[0] == 0xfe)) |
606 |
{ |
{ |
607 |
entry = cache_get_text(os->text[1]); |
entry = cache_get_text(os->text[1]); |
608 |
|
|
618 |
cache_put_text(os->text[os->length+1], os->text, os->length); |
cache_put_text(os->text[os->length+1], os->text, os->length); |
619 |
} |
} |
620 |
|
|
621 |
ui_draw_text(os->font, os->flags, os->mixmode, |
ui_draw_text(os->font, os->flags, os->mixmode, os->x, os->y, |
622 |
os->x, os->y, os->boxleft, os->boxtop, |
os->clipleft, os->cliptop, |
623 |
|
os->clipright - os->clipleft, |
624 |
|
os->clipbottom - os->cliptop, |
625 |
|
os->boxleft, os->boxtop, |
626 |
os->boxright - os->boxleft, |
os->boxright - os->boxleft, |
627 |
os->boxbottom - os->boxtop, |
os->boxbottom - os->boxtop, |
628 |
os->bgcolour, os->fgcolour, os->text, os->length); |
os->bgcolour, os->fgcolour, os->text, os->length); |
722 |
{ |
{ |
723 |
HGLYPH bitmap; |
HGLYPH bitmap; |
724 |
uint8 font, nglyphs; |
uint8 font, nglyphs; |
725 |
uint16 character, baseline, width, height; |
uint16 character, offset, baseline, width, height; |
726 |
uint8 *data, *rev_data, in, out; |
uint8 *data, *rev_data, in, out; |
727 |
int i, j, datasize; |
int i, j, datasize; |
728 |
|
|
734 |
for (i = 0; i < nglyphs; i++) |
for (i = 0; i < nglyphs; i++) |
735 |
{ |
{ |
736 |
in_uint16_le(s, character); |
in_uint16_le(s, character); |
737 |
in_uint8s(s, 2); /* unknown */ |
in_uint16_le(s, offset); |
738 |
in_uint16_le(s, baseline); |
in_uint16_le(s, baseline); |
739 |
in_uint16_le(s, width); |
in_uint16_le(s, width); |
740 |
in_uint16_le(s, height); |
in_uint16_le(s, height); |
742 |
datasize = (height * ((width + 7) / 8) + 3) & ~3; |
datasize = (height * ((width + 7) / 8) + 3) & ~3; |
743 |
in_uint8p(s, data, datasize); |
in_uint8p(s, data, datasize); |
744 |
|
|
745 |
/* Need to reverse bit order */ |
bitmap = ui_create_glyph(width, height, data); |
746 |
rev_data = xmalloc(datasize); |
cache_put_font(font, character, offset, baseline, |
747 |
|
width, height, bitmap); |
|
for (j = 0; j < datasize; j++) |
|
|
{ |
|
|
in = data[j]; |
|
|
out = 0; |
|
|
if (in & 1) out |= 128; |
|
|
if (in & 2) out |= 64; |
|
|
if (in & 4) out |= 32; |
|
|
if (in & 8) out |= 16; |
|
|
if (in & 16) out |= 8; |
|
|
if (in & 32) out |= 4; |
|
|
if (in & 64) out |= 2; |
|
|
if (in & 128) out |= 1; |
|
|
rev_data[j] = out; |
|
|
} |
|
|
|
|
|
bitmap = ui_create_glyph(width, height, rev_data); |
|
|
xfree(rev_data); |
|
|
|
|
|
cache_put_font(font, character, baseline, width, height, bitmap); |
|
748 |
} |
} |
749 |
} |
} |
750 |
|
|
895 |
present, delta); |
present, delta); |
896 |
break; |
break; |
897 |
|
|
898 |
|
case RDP_ORDER_POLYLINE: |
899 |
|
process_polyline(s, &os->polyline, |
900 |
|
present, delta); |
901 |
|
break; |
902 |
|
|
903 |
case RDP_ORDER_TEXT2: |
case RDP_ORDER_TEXT2: |
904 |
process_text2(s, &os->text2, |
process_text2(s, &os->text2, |
905 |
present, delta); |
present, delta); |
918 |
} |
} |
919 |
|
|
920 |
if (s->p != next_packet) |
if (s->p != next_packet) |
921 |
WARN("%d bytes remaining\n", next_packet - s->p); |
WARN("%d bytes remaining\n", (int)(next_packet - s->p)); |
922 |
} |
} |
923 |
|
|
924 |
/* Reset order state */ |
/* Reset order state */ |