[PATCH] gdi32: Return default palette entries from GetSystemPaletteEntries for non-palette-based devices. (try 4, resend)

Huw Davies Huw.Davies at physics.ox.ac.uk
Wed Oct 14 03:26:50 CDT 2015


On 14 Oct 2015, at 07:13, Anton Baskanov wrote:
> diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c
> index d850d0f..70a75d8 100644
> --- a/dlls/gdi32/palette.c
> +++ b/dlls/gdi32/palette.c
> @@ -418,8 +418,39 @@ UINT WINAPI GetSystemPaletteEntries(

> +        {
> +            if (entries && start < 256)
> +            {
> +                UINT i;
> +                const RGBQUAD *default_entries;
> +
> +                if (start + count > 256) count = 256 - start;
> +
> +                default_entries = get_default_color_table( 8 );
> +                for (i = 0; i < count; ++i)
> +                {
> +                    if (start + i < 10 || start + i >= 246)
> +                    {
> +                        entries[i].peRed = default_entries[start + i].rgbRed;
> +                        entries[i].peGreen = default_entries[start + i].rgbGreen;
> +                        entries[i].peBlue = default_entries[start + i].rgbBlue;
> +                    }
> +                    else
> +                    {
> +                        entries[i].peRed = 0;
> +                        entries[i].peGreen = 0;
> +                        entries[i].peBlue = 0;
> +                    }
> +                    entries[i].peFlags = 0;
> +                }
> +            }
> +        }

I think this should be moved to nulldrv_GetSystemPaletteEntries().

Then X11DRV_GetSystemPaletteEntries() should forward to this
(using GET_NEXT_PHYSDEV) in the case that 'palette_size' is zero.

This avoids the ugly GetDeviceCaps call at the beginning.

Huw.




More information about the wine-devel mailing list