static void
xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor)
{
    ScrnInfoPtr		scrn = crtc->scrn;
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
    CARD32		*cursor_image = (CARD32 *) xf86_config->cursor_image;
    CARD32		*cursor_source = (CARD32 *) cursor->bits->argb;
    int			x, y;
    int			xin, yin;
    CARD32		bits;
    int			source_width = cursor->bits->width;
    int			source_height = cursor->bits->height;
    int			image_width = cursor_info->MaxWidth;
    int			image_height = cursor_info->MaxHeight;
    
    for (y = 0; y < image_height; y++)
	for (x = 0; x < image_width; x++)
	{
	    xf86_crtc_rotate_coord (crtc->rotation, image_width, image_height,
				    x, y, &xin, &yin);
	    if (xin < source_width && yin < source_height)
		bits = cursor_source[yin * source_width + xin];
	    else
		bits = 0;
	    cursor_image[y * image_width + x] = bits;
	}
    
    crtc->funcs->load_cursor_argb (crtc, cursor_image);
}
Exemplo n.º 2
0
/*
 * Load a two-color cursor into a crtc, performing rotation as needed
 */
static Bool
xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
{
    ScrnInfoPtr scrn = crtc->scrn;
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
    CARD8 *cursor_image;
    const Rotation rotation = xf86_crtc_cursor_rotation(crtc);

    crtc->cursor_argb = FALSE;

    if (rotation == RR_Rotate_0)
        cursor_image = src;
    else {
        int x, y;
        int xin, yin;
        int stride = cursor_info->MaxWidth >> 2;

        cursor_image = xf86_config->cursor_image;
        memset(cursor_image, 0, cursor_info->MaxHeight * stride);

        for (y = 0; y < cursor_info->MaxHeight; y++)
            for (x = 0; x < cursor_info->MaxWidth; x++) {
                xf86_crtc_rotate_coord(rotation,
                                       cursor_info->MaxWidth,
                                       cursor_info->MaxHeight,
                                       x, y, &xin, &yin);
                if (get_bit(src, cursor_info, xin, yin, FALSE))
                    set_bit(cursor_image, cursor_info, x, y, FALSE);
                if (get_bit(src, cursor_info, xin, yin, TRUE))
                    set_bit(cursor_image, cursor_info, x, y, TRUE);
            }
    }
    return xf86_driver_load_cursor_image(crtc, cursor_image);
}
Exemplo n.º 3
0
/*
 * Load a two color cursor into a driver that supports only ARGB cursors
 */
static Bool
xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
{
    ScrnInfoPtr scrn = crtc->scrn;
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
    CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
    int x, y;
    int xin, yin;
    int flags = cursor_info->Flags;
    CARD32 bits;
    const Rotation rotation = xf86_crtc_cursor_rotation(crtc);

    crtc->cursor_argb = FALSE;

    for (y = 0; y < cursor_info->MaxHeight; y++)
        for (x = 0; x < cursor_info->MaxWidth; x++) {
            xf86_crtc_rotate_coord(rotation,
                                   cursor_info->MaxWidth,
                                   cursor_info->MaxHeight, x, y, &xin, &yin);
            if (get_bit(src, cursor_info, xin, yin, TRUE) ==
                ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0)) {
                if (get_bit(src, cursor_info, xin, yin, FALSE))
                    bits = xf86_config->cursor_fg;
                else
                    bits = xf86_config->cursor_bg;
            }
            else
                bits = 0;
            cursor_image[y * cursor_info->MaxWidth + x] = bits;
        }
    return xf86_driver_load_cursor_argb(crtc, cursor_image);
}
Exemplo n.º 4
0
/*
 * Load a two-color cursor into a crtc, performing rotation as needed
 */
static void
xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
{
    ScrnInfoPtr		scrn = crtc->scrn;
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
    CARD8		*cursor_image;

#ifdef ARGB_CURSOR
    crtc->cursor_argb = FALSE;
#endif

    if (crtc->rotation == RR_Rotate_0)
	cursor_image = src;
    else
    {
        int x, y;
    	int xin, yin;
	int stride = cursor_info->MaxWidth >> 2;
	int flags = cursor_info->Flags;
	
	cursor_image = xf86_config->cursor_image;
	memset(cursor_image, 0, cursor_info->MaxWidth * stride);
	
        for (y = 0; y < cursor_info->MaxHeight; y++)
	    for (x = 0; x < cursor_info->MaxWidth; x++) 
	    {
		xf86_crtc_rotate_coord (crtc->rotation,
					cursor_info->MaxWidth,
					cursor_info->MaxHeight,
					x, y, &xin, &yin);
		if (get_bit(src, stride, flags, xin, yin, FALSE))
		    set_bit(cursor_image, stride, flags, x, y, FALSE);
		if (get_bit(src, stride, flags, xin, yin, TRUE))
		    set_bit(cursor_image, stride, flags, x, y, TRUE);
	    }
    }
    crtc->funcs->load_cursor_image (crtc, cursor_image);
}
Exemplo n.º 5
0
/*
 * Load a two color cursor into a driver that supports only ARGB cursors
 */
static void
xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
{
    ScrnInfoPtr		scrn = crtc->scrn;
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
    CARD32		*cursor_image = (CARD32 *) xf86_config->cursor_image;
    int			x, y;
    int			xin, yin;
    int			stride = cursor_info->MaxWidth >> 2;
    int			flags = cursor_info->Flags;
    CARD32		bits;

#ifdef ARGB_CURSOR
    crtc->cursor_argb = FALSE;
#endif

    for (y = 0; y < cursor_info->MaxHeight; y++)
	for (x = 0; x < cursor_info->MaxWidth; x++) 
	{
	    xf86_crtc_rotate_coord (crtc->rotation,
				    cursor_info->MaxWidth,
				    cursor_info->MaxHeight,
				    x, y, &xin, &yin);
	    if (get_bit (src, stride, flags, xin, yin, TRUE) ==
		((flags & HARDWARE_CURSOR_INVERT_MASK) == 0))
	    {
		if (get_bit (src, stride, flags, xin, yin, FALSE))
		    bits = xf86_config->cursor_fg;
		else
		    bits = xf86_config->cursor_bg;
	    }
	    else
		bits = 0;
	    cursor_image[y * cursor_info->MaxWidth + x] = bits;
	}
    crtc->funcs->load_cursor_argb (crtc, cursor_image);
}