new(color) cursors working now

ulab-next
Jay Sorg 12 years ago
parent 12f7cd64f1
commit 6beddfde28

@ -47,6 +47,7 @@ keyboard and mouse stuff
extern ScreenPtr g_pScreen; /* in rdpmain.c */
extern DeviceIntPtr g_pointer; /* in rdpmain.c */
extern DeviceIntPtr g_keyboard; /* in rdpmain.c */
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
static int g_old_button_mask = 0;
static int g_pause_spe = 0;
@ -519,6 +520,7 @@ get_pixel_safe(char *data, int x, int y, int width, int height, int bpp)
int start;
int shift;
int c;
unsigned int *src32;
if (x < 0)
{
@ -552,6 +554,11 @@ get_pixel_safe(char *data, int x, int y, int width, int height, int bpp)
return (c & (0x80 >> shift)) != 0;
#endif
}
else if (bpp == 32)
{
src32 = (unsigned int*)data;
return src32[y * width + x];
}
return 0;
}
@ -563,6 +570,7 @@ set_pixel_safe(char *data, int x, int y, int width, int height, int bpp,
{
int start;
int shift;
unsigned int *dst32;
if (x < 0)
{
@ -605,6 +613,11 @@ set_pixel_safe(char *data, int x, int y, int width, int height, int bpp,
*(data + (3 * (y * width + x)) + 1) = pixel >> 8;
*(data + (3 * (y * width + x)) + 2) = pixel >> 16;
}
else if (bpp == 32)
{
dst32 = (unsigned int*)data;
dst32[y * width + x] = pixel;
}
}
/******************************************************************************/
@ -612,7 +625,7 @@ void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y)
{
char cur_data[32 * (32 * 3)];
char cur_data[32 * (32 * 4)];
char cur_mask[32 * (32 / 8)];
char *mask;
char *data;
@ -626,6 +639,7 @@ rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int paddedRowBytes;
int fgcolor;
int bgcolor;
int bpp;
if (pCurs == 0)
{
@ -639,39 +653,62 @@ rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
w = pCurs->bits->width;
h = pCurs->bits->height;
paddedRowBytes = PixmapBytePad(w, 1);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
/* ErrorF("xhot %d yhot %d\n", xhot, yhot); */
data = (char *)(pCurs->bits->source);
mask = (char *)(pCurs->bits->mask);
fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) |
(((pCurs->foreGreen >> 8) & 0xff) << 8) |
((pCurs->foreBlue >> 8) & 0xff);
bgcolor = (((pCurs->backRed >> 8) & 0xff) << 16) |
(((pCurs->backGreen >> 8) & 0xff) << 8) |
((pCurs->backBlue >> 8) & 0xff);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
if ((pCurs->bits->argb != 0) &&
(g_rdpScreen.client_info.pointer_flags & 1))
{
for (i = 0; i < 32; i++)
bpp = 32;
paddedRowBytes = PixmapBytePad(w, 32);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
data = (char *)(pCurs->bits->argb);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
{
p = get_pixel_safe(mask, i, j, paddedRowBytes * 8, h, 1);
set_pixel_safe(cur_mask, i, 31 - j, 32, 32, 1, !p);
if (p != 0)
for (i = 0; i < 32; i++)
{
p = get_pixel_safe(data, i, j, paddedRowBytes * 8, h, 1);
p = p ? fgcolor : bgcolor;
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 24, p);
p = get_pixel_safe(data, i, j, paddedRowBytes / 4, h, 32);
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 32, p);
}
}
}
else
{
bpp = 0;
paddedRowBytes = PixmapBytePad(w, 1);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
data = (char *)(pCurs->bits->source);
mask = (char *)(pCurs->bits->mask);
fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) |
(((pCurs->foreGreen >> 8) & 0xff) << 8) |
((pCurs->foreBlue >> 8) & 0xff);
bgcolor = (((pCurs->backRed >> 8) & 0xff) << 16) |
(((pCurs->backGreen >> 8) & 0xff) << 8) |
((pCurs->backBlue >> 8) & 0xff);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
{
for (i = 0; i < 32; i++)
{
p = get_pixel_safe(mask, i, j, paddedRowBytes * 8, h, 1);
set_pixel_safe(cur_mask, i, 31 - j, 32, 32, 1, !p);
if (p != 0)
{
p = get_pixel_safe(data, i, j, paddedRowBytes * 8, h, 1);
p = p ? fgcolor : bgcolor;
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 24, p);
}
}
}
}
rdpup_begin_update();
rdpup_set_cursor_ex(xhot, yhot, cur_data, cur_mask, 0);
rdpup_set_cursor_ex(xhot, yhot, cur_data, cur_mask, bpp);
rdpup_end_update();
}

@ -504,10 +504,11 @@ xrdp_cache_add_pointer(struct xrdp_cache *self,
self->pointer_items[index].x = pointer_item->x;
self->pointer_items[index].y = pointer_item->y;
g_memcpy(self->pointer_items[index].data,
pointer_item->data, 32 * 32 * 3);
pointer_item->data, 32 * 32 * 4);
g_memcpy(self->pointer_items[index].mask,
pointer_item->mask, 32 * 32 / 8);
self->pointer_items[index].stamp = self->pointer_stamp;
self->pointer_items[index].bpp = pointer_item->bpp;
xrdp_wm_send_pointer(self->wm, index,
self->pointer_items[index].data,
self->pointer_items[index].mask,
@ -535,10 +536,11 @@ xrdp_cache_add_pointer_static(struct xrdp_cache *self,
self->pointer_items[index].x = pointer_item->x;
self->pointer_items[index].y = pointer_item->y;
g_memcpy(self->pointer_items[index].data,
pointer_item->data, 32 * 32 * 3);
pointer_item->data, 32 * 32 * 4);
g_memcpy(self->pointer_items[index].mask,
pointer_item->mask, 32 * 32 / 8);
self->pointer_items[index].stamp = self->pointer_stamp;
self->pointer_items[index].bpp = pointer_item->bpp;
xrdp_wm_send_pointer(self->wm, index,
self->pointer_items[index].data,
self->pointer_items[index].mask,

Loading…
Cancel
Save