From b1ac59b9e9600a8293a6601bb50d77e4e701d511 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Mon, 5 Jan 2015 19:30:44 +0100 Subject: [PATCH] winex11.drv: Make X11DRV_PALETTE_ComputeColorShifts() static. --- dlls/winex11.drv/palette.c | 116 ++++++++++++++++++------------------- dlls/winex11.drv/x11drv.h | 1 - 2 files changed, 58 insertions(+), 59 deletions(-) diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c index cf049c5ae8b..a399ec9552c 100644 --- a/dlls/winex11.drv/palette.c +++ b/dlls/winex11.drv/palette.c @@ -126,6 +126,64 @@ static void palette_set_mapping( HPALETTE hpal, int *mapping ) } +/*********************************************************************** + * 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 * @@ -210,64 +268,6 @@ int X11DRV_PALETTE_Init(void) return palette_size; } -/*********************************************************************** - * 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 * diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index bcbfe1473d2..0adf7f328dd 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -267,7 +267,6 @@ extern BOOL X11DRV_IsSolidColor(COLORREF color) DECLSPEC_HIDDEN; extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel) DECLSPEC_HIDDEN; extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color) DECLSPEC_HIDDEN; extern COLORREF X11DRV_PALETTE_GetColor( X11DRV_PDEVICE *physDev, COLORREF color ) DECLSPEC_HIDDEN; -extern void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask) DECLSPEC_HIDDEN; /* GDI escapes */