Commit 5db05dfe authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

winex11: Use ColorShifts data in X11DRV_PALETTE_ToLogical.

parent 5fc017c4
...@@ -2201,7 +2201,7 @@ static void X11DRV_DIB_SetImageBits_16( int lines, const BYTE *srcbits, ...@@ -2201,7 +2201,7 @@ static void X11DRV_DIB_SetImageBits_16( int lines, const BYTE *srcbits,
* *
* GetDIBits for an 16-bit deep DIB. * GetDIBits for an 16-bit deep DIB.
*/ */
static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits, static void X11DRV_DIB_GetImageBits_16( X11DRV_PDEVICE *physDev, int lines, BYTE *dstbits,
DWORD dstwidth, DWORD srcwidth, DWORD dstwidth, DWORD srcwidth,
PALETTEENTRY *srccolors, PALETTEENTRY *srccolors,
DWORD rDst, DWORD gDst, DWORD bDst, DWORD rDst, DWORD gDst, DWORD bDst,
...@@ -2509,7 +2509,7 @@ static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits, ...@@ -2509,7 +2509,7 @@ static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits,
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
COLORREF srcval; COLORREF srcval;
DWORD dstval; DWORD dstval;
srcval=X11DRV_PALETTE_ToLogical(XGetPixel(bmpImage, x, h)); srcval=X11DRV_PALETTE_ToLogical(physDev, XGetPixel(bmpImage, x, h));
dstval=((GetRValue(srcval) << rShift) & rDst) | dstval=((GetRValue(srcval) << rShift) & rDst) |
((GetGValue(srcval) << gShift) & gDst) | ((GetGValue(srcval) << gShift) & gDst) |
((GetBValue(srcval) << bShift) & bDst); ((GetBValue(srcval) << bShift) & bDst);
...@@ -2694,7 +2694,7 @@ static void X11DRV_DIB_SetImageBits_24( int lines, const BYTE *srcbits, ...@@ -2694,7 +2694,7 @@ static void X11DRV_DIB_SetImageBits_24( int lines, const BYTE *srcbits,
* *
* GetDIBits for an 24-bit deep DIB. * GetDIBits for an 24-bit deep DIB.
*/ */
static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits, static void X11DRV_DIB_GetImageBits_24( X11DRV_PDEVICE *physDev, int lines, BYTE *dstbits,
DWORD dstwidth, DWORD srcwidth, DWORD dstwidth, DWORD srcwidth,
PALETTEENTRY *srccolors, PALETTEENTRY *srccolors,
DWORD rDst, DWORD gDst, DWORD bDst, DWORD rDst, DWORD gDst, DWORD bDst,
...@@ -2891,7 +2891,7 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits, ...@@ -2891,7 +2891,7 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits,
dstbyte=dstbits; dstbyte=dstbits;
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
COLORREF srcval=X11DRV_PALETTE_ToLogical COLORREF srcval=X11DRV_PALETTE_ToLogical
(XGetPixel( bmpImage, x, h )); (physDev, XGetPixel( bmpImage, x, h ));
dstbyte[0]=GetBValue(srcval); dstbyte[0]=GetBValue(srcval);
dstbyte[1]=GetGValue(srcval); dstbyte[1]=GetGValue(srcval);
dstbyte[2]=GetRValue(srcval); dstbyte[2]=GetRValue(srcval);
...@@ -3176,7 +3176,7 @@ static void X11DRV_DIB_SetImageBits_32(int lines, const BYTE *srcbits, ...@@ -3176,7 +3176,7 @@ static void X11DRV_DIB_SetImageBits_32(int lines, const BYTE *srcbits,
* *
* GetDIBits for an 32-bit deep DIB. * GetDIBits for an 32-bit deep DIB.
*/ */
static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits, static void X11DRV_DIB_GetImageBits_32( X11DRV_PDEVICE *physDev, int lines, BYTE *dstbits,
DWORD dstwidth, DWORD srcwidth, DWORD dstwidth, DWORD srcwidth,
PALETTEENTRY *srccolors, PALETTEENTRY *srccolors,
DWORD rDst, DWORD gDst, DWORD bDst, DWORD rDst, DWORD gDst, DWORD bDst,
...@@ -3475,7 +3475,7 @@ static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits, ...@@ -3475,7 +3475,7 @@ static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits,
dstpixel=(DWORD*)dstbits; dstpixel=(DWORD*)dstbits;
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
COLORREF srcval; COLORREF srcval;
srcval=X11DRV_PALETTE_ToLogical(XGetPixel(bmpImage, x, h)); srcval=X11DRV_PALETTE_ToLogical(physDev, XGetPixel(bmpImage, x, h));
*dstpixel++=(GetRValue(srcval) << rShift) | *dstpixel++=(GetRValue(srcval) << rShift) |
(GetGValue(srcval) << gShift) | (GetGValue(srcval) << gShift) |
(GetBValue(srcval) << bShift); (GetBValue(srcval) << bShift);
...@@ -3798,7 +3798,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) ...@@ -3798,7 +3798,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
break; break;
case 15: case 15:
case 16: case 16:
X11DRV_DIB_GetImageBits_16( descr->lines, (LPVOID)descr->bits, X11DRV_DIB_GetImageBits_16( descr->physDev, descr->lines, (LPVOID)descr->bits,
descr->infoWidth,descr->width, descr->infoWidth,descr->width,
descr->palentry, descr->palentry,
descr->rMask, descr->gMask, descr->bMask, descr->rMask, descr->gMask, descr->bMask,
...@@ -3806,7 +3806,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) ...@@ -3806,7 +3806,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
break; break;
case 24: case 24:
X11DRV_DIB_GetImageBits_24( descr->lines, (LPVOID)descr->bits, X11DRV_DIB_GetImageBits_24( descr->physDev, descr->lines, (LPVOID)descr->bits,
descr->infoWidth,descr->width, descr->infoWidth,descr->width,
descr->palentry, descr->palentry,
descr->rMask, descr->gMask, descr->bMask, descr->rMask, descr->gMask, descr->bMask,
...@@ -3814,7 +3814,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) ...@@ -3814,7 +3814,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
break; break;
case 32: case 32:
X11DRV_DIB_GetImageBits_32( descr->lines, (LPVOID)descr->bits, X11DRV_DIB_GetImageBits_32( descr->physDev, descr->lines, (LPVOID)descr->bits,
descr->infoWidth, descr->width, descr->infoWidth, descr->width,
descr->palentry, descr->palentry,
descr->rMask, descr->gMask, descr->bMask, descr->rMask, descr->gMask, descr->bMask,
...@@ -4151,7 +4151,7 @@ INT CDECL X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start ...@@ -4151,7 +4151,7 @@ INT CDECL X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
WORD *index = colorPtr; WORD *index = colorPtr;
descr.colorMap = rgb = HeapAlloc(GetProcessHeap(), 0, num_colors * sizeof(RGBQUAD)); descr.colorMap = rgb = HeapAlloc(GetProcessHeap(), 0, num_colors * sizeof(RGBQUAD));
for(i = 0; i < num_colors; i++, rgb++, index++) { for(i = 0; i < num_colors; i++, rgb++, index++) {
colref = X11DRV_PALETTE_ToLogical(X11DRV_PALETTE_ToPhysical(physDev, PALETTEINDEX(*index))); colref = X11DRV_PALETTE_ToLogical(physDev, X11DRV_PALETTE_ToPhysical(physDev, PALETTEINDEX(*index)));
rgb->rgbRed = GetRValue(colref); rgb->rgbRed = GetRValue(colref);
rgb->rgbGreen = GetGValue(colref); rgb->rgbGreen = GetGValue(colref);
rgb->rgbBlue = GetBValue(colref); rgb->rgbBlue = GetBValue(colref);
......
...@@ -1036,7 +1036,7 @@ X11DRV_SetPixel( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color ) ...@@ -1036,7 +1036,7 @@ X11DRV_SetPixel( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color )
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(physDev, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
return X11DRV_PALETTE_ToLogical(pixel); return X11DRV_PALETTE_ToLogical(physDev, pixel);
} }
...@@ -1083,7 +1083,7 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y ) ...@@ -1083,7 +1083,7 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(physDev, FALSE); X11DRV_UnlockDIBSection(physDev, FALSE);
if( physDev->depth > 1) if( physDev->depth > 1)
pixel = X11DRV_PALETTE_ToLogical(pixel); pixel = X11DRV_PALETTE_ToLogical(physDev, pixel);
else else
/* monochrome bitmaps return black or white */ /* monochrome bitmaps return black or white */
if( pixel) pixel = 0xffffff; if( pixel) pixel = 0xffffff;
......
...@@ -779,11 +779,14 @@ BOOL X11DRV_IsSolidColor( COLORREF color ) ...@@ -779,11 +779,14 @@ BOOL X11DRV_IsSolidColor( COLORREF color )
* *
* Return RGB color for given X pixel. * Return RGB color for given X pixel.
*/ */
COLORREF X11DRV_PALETTE_ToLogical(int pixel) COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel)
{ {
XColor color; XColor color;
ColorShifts *shifts = &X11DRV_PALETTE_default_shifts; ColorShifts *shifts = &X11DRV_PALETTE_default_shifts;
if(physDev->color_shifts)
shifts = physDev->color_shifts;
#if 0 #if 0
/* truecolor visual */ /* truecolor visual */
......
...@@ -490,7 +490,7 @@ extern int X11DRV_PALETTE_Init(void); ...@@ -490,7 +490,7 @@ extern int X11DRV_PALETTE_Init(void);
extern void X11DRV_PALETTE_Cleanup(void); extern void X11DRV_PALETTE_Cleanup(void);
extern BOOL X11DRV_IsSolidColor(COLORREF color); extern BOOL X11DRV_IsSolidColor(COLORREF color);
extern COLORREF X11DRV_PALETTE_ToLogical(int pixel); extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel);
extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color); extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
extern int X11DRV_PALETTE_LookupPixel(COLORREF color); extern int X11DRV_PALETTE_LookupPixel(COLORREF color);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment