winex11: Make X11DRV_PALETTE_ComputeColorShifts() static.

Roderick Colenbrander thunderbird2k at gmail.com
Thu Sep 10 11:10:29 CDT 2009


In a next patch ComputeChannelShift will be called from outside
palette.c and for this reason I made it non-static.

Roderick

On Thu, Sep 10, 2009 at 5:58 PM, Francois Gouget <fgouget at free.fr> wrote:
> ---
>  dlls/winex11.drv/palette.c |  115 ++++++++++++++++++++++----------------------
>  dlls/winex11.drv/x11drv.h  |    1 -
>  2 files changed, 57 insertions(+), 59 deletions(-)
>
> diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c
> index 81bb73b..cdbfb21 100644
> --- a/dlls/winex11.drv/palette.c
> +++ b/dlls/winex11.drv/palette.c
> @@ -131,6 +131,63 @@ static void palette_set_mapping( HPALETTE hpal, int *mapping )
>     wine_tsx11_unlock();
>  }
>
> +/***********************************************************************
> + *             X11DRV_PALETTE_ComputeChannelShift
> + *
> + * Calculate conversion parameters for a given color mask
> + */
> +static void X11DRV_PALETTE_ComputeChannelShift(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical)
> +{
> +    int i;
> +
> +    if (maskbits==0)
> +    {
> +        physical->shift=0;
> +        physical->scale=0;
> +        physical->max=0;
> +        to_logical->shift=0;
> +        to_logical->scale=0;
> +        to_logical->max=0;
> +        return;
> +    }
> +
> +    for(i=0;!(maskbits&1);i++)
> +        maskbits >>= 1;
> +
> +    physical->shift = i;
> +    physical->max = maskbits;
> +
> +    for(i=0;maskbits!=0;i++)
> +        maskbits >>= 1;
> +    physical->scale = i;
> +
> +    if (physical->scale>8)
> +    {
> +        /* On FreeBSD, VNC's default 32bpp mode is bgrabb (ffc00000,3ff800,7ff)!
> +         * So we adjust the shifts to also normalize the color fields to
> +         * the Win32 standard of 8 bits per color.
> +         */
> +        to_logical->shift=physical->shift+(physical->scale-8);
> +        to_logical->scale=8;
> +        to_logical->max=0xff;
> +    } else {
> +        to_logical->shift=physical->shift;
> +        to_logical->scale=physical->scale;
> +        to_logical->max=physical->max;
> +    }
> +}
> +
> +/***********************************************************************
> + *      X11DRV_PALETTE_ComputeColorShifts
> + *
> + * Calculate conversion parameters for a given color
> + */
> +static void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask)
> +{
> +    X11DRV_PALETTE_ComputeChannelShift(redMask, &shifts->physicalRed, &shifts->logicalRed);
> +    X11DRV_PALETTE_ComputeChannelShift(greenMask, &shifts->physicalGreen, &shifts->logicalGreen);
> +    X11DRV_PALETTE_ComputeChannelShift(blueMask, &shifts->physicalBlue, &shifts->logicalBlue);
> +}
>
>  /***********************************************************************
>  *           COLOR_Init
> @@ -278,64 +335,6 @@ void X11DRV_PALETTE_Cleanup(void)
>  }
>
>  /***********************************************************************
> - *             X11DRV_PALETTE_ComputeChannelShift
> - *
> - * Calculate conversion parameters for a given color mask
> - */
> -static void X11DRV_PALETTE_ComputeChannelShift(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical)
> -{
> -    int i;
> -
> -    if (maskbits==0)
> -    {
> -        physical->shift=0;
> -        physical->scale=0;
> -        physical->max=0;
> -        to_logical->shift=0;
> -        to_logical->scale=0;
> -        to_logical->max=0;
> -        return;
> -    }
> -
> -    for(i=0;!(maskbits&1);i++)
> -        maskbits >>= 1;
> -
> -    physical->shift = i;
> -    physical->max = maskbits;
> -
> -    for(i=0;maskbits!=0;i++)
> -        maskbits >>= 1;
> -    physical->scale = i;
> -
> -    if (physical->scale>8)
> -    {
> -        /* On FreeBSD, VNC's default 32bpp mode is bgrabb (ffc00000,3ff800,7ff)!
> -         * So we adjust the shifts to also normalize the color fields to
> -         * the Win32 standard of 8 bits per color.
> -         */
> -        to_logical->shift=physical->shift+(physical->scale-8);
> -        to_logical->scale=8;
> -        to_logical->max=0xff;
> -    } else {
> -        to_logical->shift=physical->shift;
> -        to_logical->scale=physical->scale;
> -        to_logical->max=physical->max;
> -    }
> -}
> -
> -/***********************************************************************
> - *      X11DRV_PALETTE_ComputeColorShifts
> - *
> - * Calculate conversion parameters for a given color
> - */
> -void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask)
> -{
> -    X11DRV_PALETTE_ComputeChannelShift(redMask, &shifts->physicalRed, &shifts->logicalRed);
> -    X11DRV_PALETTE_ComputeChannelShift(greenMask, &shifts->physicalGreen, &shifts->logicalGreen);
> -    X11DRV_PALETTE_ComputeChannelShift(blueMask, &shifts->physicalBlue, &shifts->logicalBlue);
> -}
> -
> -/***********************************************************************
>  *           X11DRV_PALETTE_BuildPrivateMap
>  *
>  * Allocate colorcells and initialize mapping tables.
> diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
> index 62b0d63..844af31 100644
> --- a/dlls/winex11.drv/x11drv.h
> +++ b/dlls/winex11.drv/x11drv.h
> @@ -494,7 +494,6 @@ extern BOOL X11DRV_IsSolidColor(COLORREF color);
>  extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel);
>  extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
>  extern int X11DRV_PALETTE_LookupPixel(COLORREF color);
> -extern void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask);
>
>  extern unsigned int depth_to_bpp( unsigned int depth );
>
> --
> 1.6.3.3
>
>
>



More information about the wine-patches mailing list