--- sourceforge.net/trunk/rdesktop/xwin.c 2003/03/14 12:00:17 342 +++ sourceforge.net/trunk/rdesktop/xwin.c 2003/05/19 21:36:33 376 @@ -402,8 +402,9 @@ uint32 pixel = 0; while (out < end) { - memcpy(&pixel, data, 3); - data += 3; + pixel = *(data++); + pixel |= *(data++) << 8; + pixel |= *(data++) << 16; *(out++) = pixel; } } @@ -412,7 +413,7 @@ translate_image(int width, int height, uint8 * data) { int size = width * height * bpp / 8; - uint8 *out = xmalloc(size); + uint8 *out = (uint8*)xmalloc(size); uint8 *end = out + size; switch (server_bpp) @@ -786,7 +787,7 @@ case ClientMessage: /* the window manager told us to quit */ if ((xevent.xclient.message_type == protocol_atom) - && (xevent.xclient.data.l[0] == kill_atom)) + && ((Atom)xevent.xclient.data.l[0] == kill_atom)) /* Quit */ return 0; break; @@ -1136,10 +1137,10 @@ scanline = (width + 7) / 8; offset = scanline * height; - cursor = xmalloc(offset); + cursor = (uint8*)xmalloc(offset); memset(cursor, 0, offset); - mask = xmalloc(offset); + mask = (uint8*)xmalloc(offset); memset(mask, 0, offset); /* approximate AND and XOR masks with a monochrome X pointer */ @@ -1218,7 +1219,7 @@ int i, ncolours = colours->ncolours; if (!owncolmap) { - uint32 *map = xmalloc(sizeof(*colmap) * ncolours); + uint32 *map = (uint32*)xmalloc(sizeof(*colmap) * ncolours); XColor xentry; XColor xc_cache[256]; uint32 colour; @@ -1296,7 +1297,7 @@ XColor *xcolours, *xentry; Colormap map; - xcolours = xmalloc(sizeof(XColor) * ncolours); + xcolours = (XColor*)xmalloc(sizeof(XColor) * ncolours); for (i = 0; i < ncolours; i++) { entry = &colours->colours[i]; @@ -1326,7 +1327,7 @@ ui_set_colourmap(HCOLOURMAP map) { if (!owncolmap) - colmap = map; + colmap = (uint32*)map; else XSetWindowColormap(display, wnd, (Colormap) map); } @@ -1370,6 +1371,15 @@ RESET_FUNCTION(opcode); } +static uint8 hatch_patterns[] = { + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0 - bsHorizontal */ + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, /* 1 - bsVertical */ + 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, /* 2 - bsFDiagonal */ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, /* 3 - bsBDiagonal */ + 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08, /* 4 - bsCross */ + 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 /* 5 - bsDiagCross */ +}; + void ui_patblt(uint8 opcode, /* dest */ int x, int y, int cx, int cy, @@ -1387,6 +1397,19 @@ FILL_RECTANGLE(x, y, cx, cy); break; + case 2: /* Hatch */ + fill = (Pixmap) ui_create_glyph(8, 8, hatch_patterns + brush->pattern[0] * 8); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(display, gc, FillOpaqueStippled); + XSetStipple(display, gc, fill); + XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin); + FILL_RECTANGLE(x, y, cx, cy); + XSetFillStyle(display, gc, FillSolid); + XSetTSOrigin(display, gc, 0, 0); + ui_destroy_glyph((HGLYPH) fill); + break; + case 3: /* Pattern */ for (i = 0; i != 8; i++) ipattern[7 - i] = brush->pattern[i];