This patch teaches XDirectFB to use the XRender ARGB cursor. Really sweet
looking stuff :) I tried not to mess up the regular cursor/shadow code in
the process.
--
Ville Syrj�l�
[EMAIL PROTECTED]
http://www.sci.fi/~syrjala/
--- XDirectFB/xc/programs/Xserver/hw/directfb/directfbCursor.c Mon Jan 20 23:36:00
2003
+++ XDirectFB/xc/programs/Xserver/hw/directfb/directfbCursor.c Thu Feb 13 09:49:11
+2003
@@ -59,14 +59,16 @@
width = pCursor->bits->width;
height = pCursor->bits->height;
- /* add shadow */
- full_width = width + 4;
- full_height = height + 4;
-
- /* allocate shadow data */
- shadow_data = alloca (full_width * full_height);
- memset (shadow_data, 0, full_width * full_height);
+ full_width = width;
+ full_height = height;
+ if (!pCursor->bits->argb)
+ {
+ /* add shadow */
+ full_width += + 4;
+ full_height += + 4;
+ }
+
/* fill surface description for cursor shape */
dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
dsc.width = full_width;
@@ -90,6 +92,34 @@
return NULL;
}
+ if (pCursor->bits->argb)
+ {
+ CARD32 *src = pCursor->bits->argb;
+ dst = data;
+
+ /* render cursor image */
+ for (y=0; y<height; y++)
+ {
+ for (x=0; x<width; x++)
+ {
+ dst[x] = src[x];
+ }
+
+ /* next line */
+ src += width;
+ dst += pitch / 4;
+ }
+
+ /* unlock before returning */
+ surface->Unlock (surface);
+
+ return surface;
+ }
+
+ /* allocate shadow data */
+ shadow_data = alloca (full_width * full_height);
+ memset (shadow_data, 0, full_width * full_height);
+
/* calculate foreground/background pixel values for ARGB */
colors[0] = (pCursor->backRed & 0xff00) << 8 |
(pCursor->backGreen & 0xff00) |