[PATCH 3/3] winex11: Add support for animated cursors in X11 driver.

Alexandre Julliard julliard at winehq.org
Tue Sep 28 10:01:43 CDT 2010


Erich Hoover <ehoover at mines.edu> writes:

> @@ -508,35 +517,90 @@ static Cursor create_xcursor_cursor( HDC hdc, ICONINFO *icon, int width, int hei
>      info->bmiHeader.biYPelsPerMeter = 0;
>      info->bmiHeader.biClrUsed = 0;
>      info->bmiHeader.biClrImportant = 0;
> -    GetDIBits( hdc, icon->hbmColor, 0, height, image->pixels, info, DIB_RGB_COLORS );
> +    hbmColor = CreateDIBSection( hdc, info, DIB_RGB_COLORS, (VOID **) &mem_bits, NULL, 0);
> +    if (!hbmColor)
> +    {
> +        ERR("Failed to create DIB section for image!\n");
> +        goto cleanup;
> +    }
> +    SelectObject( hdc, hbmColor );
> +    if (!DrawIconEx( hdc, 0, 0, icon, width, height, istep, NULL, DI_NORMAL ))
> +    {
> +        TRACE("Could not draw frame %d (walk past end of frames).\n", istep);
> +        goto cleanup;
> +    }
> +    memcpy(image->pixels, mem_bits, info->bmiHeader.biSizeImage);

You should be reusing the info, DC and bitmap objects for all frames
instead of always recreating everything from scratch.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list