41 |
|
|
42 |
display = XOpenDisplay(NULL); |
display = XOpenDisplay(NULL); |
43 |
if (display == NULL) |
if (display == NULL) |
44 |
|
{ |
45 |
|
ERROR("Failed to open display\n"); |
46 |
return False; |
return False; |
47 |
|
} |
48 |
|
|
49 |
/* Check the screen supports 8-bit depth. */ |
/* Check the screen supports 8-bit depth. */ |
50 |
screen = DefaultScreenOfDisplay(display); |
screen = DefaultScreenOfDisplay(display); |
422 |
|
|
423 |
switch (opcode) |
switch (opcode) |
424 |
{ |
{ |
425 |
|
case 0x69: /* PDSxxn */ |
426 |
|
ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy); |
427 |
|
ui_patblt(ROP2_NXOR, x, y, cx, cy, |
428 |
|
brush, bgcolour, fgcolour); |
429 |
|
break; |
430 |
|
|
431 |
case 0xb8: /* PSDPxax */ |
case 0xb8: /* PSDPxax */ |
432 |
ui_patblt(ROP2_XOR, x, y, cx, cy, |
ui_patblt(ROP2_XOR, x, y, cx, cy, |
433 |
brush, bgcolour, fgcolour); |
brush, bgcolour, fgcolour); |
434 |
ui_memblt(ROP2_AND, x, y, cx, cy, |
ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy); |
|
src, srcx, srcy); |
|
435 |
ui_patblt(ROP2_XOR, x, y, cx, cy, |
ui_patblt(ROP2_XOR, x, y, cx, cy, |
436 |
brush, bgcolour, fgcolour); |
brush, bgcolour, fgcolour); |
437 |
break; |
break; |
438 |
|
|
439 |
default: |
default: |
440 |
NOTIMP("triblt 0x%x\n", opcode); |
NOTIMP("triblt 0x%x\n", opcode); |
441 |
ui_memblt(ROP2_COPY, x, y, cx, cy, |
ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy); |
|
brush, bgcolour, fgcolour); |
|
442 |
} |
} |
443 |
} |
} |
444 |
|
|
494 |
} |
} |
495 |
} |
} |
496 |
|
|
497 |
void ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, |
void ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, |
498 |
int y, int boxx, int boxy, int boxcx, int boxcy, |
int clipx, int clipy, int clipcx, int clipcy, |
499 |
|
int boxx, int boxy, int boxcx, int boxcy, |
500 |
int bgcolour, int fgcolour, uint8 *text, uint8 length) |
int bgcolour, int fgcolour, uint8 *text, uint8 length) |
501 |
{ |
{ |
502 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
506 |
{ |
{ |
507 |
ui_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
ui_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
508 |
} |
} |
509 |
|
else if (mixmode == MIX_OPAQUE) |
510 |
|
{ |
511 |
|
ui_rect(clipx, clipy, clipcx, clipcy, bgcolour); |
512 |
|
} |
513 |
|
|
514 |
/* Paint text, character by character */ |
/* Paint text, character by character */ |
515 |
for (i = 0; i < length; i++) |
for (i = 0; i < length; i++) |
516 |
{ |
{ |
517 |
glyph = cache_get_font(font, text[i]); |
glyph = cache_get_font(font, text[i]); |
518 |
|
|
519 |
|
if (!(flags & TEXT2_IMPLICIT_X)) |
520 |
|
x += text[++i]; |
521 |
|
|
522 |
if (glyph != NULL) |
if (glyph != NULL) |
523 |
{ |
{ |
524 |
ui_draw_glyph(mixmode, x, |
ui_draw_glyph(mixmode, x + (short)glyph->offset, |
525 |
y + (short)glyph->baseline, |
y + (short)glyph->baseline, |
526 |
glyph->width, glyph->height, |
glyph->width, glyph->height, |
527 |
glyph->pixmap, 0, 0, |
glyph->pixmap, 0, 0, |
529 |
|
|
530 |
if (flags & TEXT2_IMPLICIT_X) |
if (flags & TEXT2_IMPLICIT_X) |
531 |
x += glyph->width; |
x += glyph->width; |
|
else |
|
|
x += text[++i]; |
|
532 |
} |
} |
533 |
} |
} |
534 |
} |
} |
536 |
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) |
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) |
537 |
{ |
{ |
538 |
XImage *image; |
XImage *image; |
|
int scanline; |
|
539 |
|
|
|
scanline = (cx + 3) & ~3; |
|
|
DEBUG("XGetImage(%p,%x,%d,%d,%d,%d,%x,%d)\n", display, wnd, x, y, |
|
|
cx, cy, 0xffffffff, ZPixmap); |
|
540 |
image = XGetImage(display, wnd, x, y, cx, cy, 0xffffffff, ZPixmap); |
image = XGetImage(display, wnd, x, y, cx, cy, 0xffffffff, ZPixmap); |
541 |
cache_put_desktop(offset, scanline*cy, image->data); |
cache_put_desktop(offset, cx, cy, image->bytes_per_line, image->data); |
542 |
XFree(image->data); |
XFree(image->data); |
543 |
XFree(image); |
XFree(image); |
544 |
} |
} |
546 |
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) |
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) |
547 |
{ |
{ |
548 |
XImage *image; |
XImage *image; |
|
int scanline; |
|
549 |
uint8 *data; |
uint8 *data; |
550 |
|
|
551 |
scanline = (cx + 3) & ~3; |
data = cache_get_desktop(offset, cx, cy); |
|
data = cache_get_desktop(offset, scanline*cy); |
|
552 |
if (data == NULL) |
if (data == NULL) |
553 |
return; |
return; |
554 |
|
|
555 |
image = XCreateImage(display, visual, 8, ZPixmap, 0, |
image = XCreateImage(display, visual, 8, ZPixmap, 0, |
556 |
data, cx, cy, 32, scanline); |
data, cx, cy, 32, cx); |
557 |
XSetFunction(display, gc, GXcopy); |
XSetFunction(display, gc, GXcopy); |
558 |
XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy); |
XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy); |
559 |
XFree(image); |
XFree(image); |