Commit 783a8697 authored by Oldrich Jedlicka's avatar Oldrich Jedlicka Committed by Alexandre Julliard

Fix for RGB mask that corresponds to the visual's mask.

parent 7849ea59
...@@ -521,6 +521,18 @@ INT X11DRV_DIB_MaskToShift(DWORD mask) ...@@ -521,6 +521,18 @@ INT X11DRV_DIB_MaskToShift(DWORD mask)
} }
/*********************************************************************** /***********************************************************************
* X11DRV_DIB_CheckMask
*
* Check RGB mask if it is either 0 or matches visual's mask.
*/
static inline int X11DRV_DIB_CheckMask(int red_mask, int green_mask, int blue_mask)
{
return ( red_mask == 0 && green_mask == 0 && blue_mask == 0 ) ||
( red_mask == visual->red_mask && green_mask == visual->green_mask &&
blue_mask == visual->blue_mask );
}
/***********************************************************************
* X11DRV_DIB_SetImageBits_1 * X11DRV_DIB_SetImageBits_1
* *
* SetDIBits for a 1-bit deep DIB. * SetDIBits for a 1-bit deep DIB.
...@@ -602,7 +614,8 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, ...@@ -602,7 +614,8 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits,
{ {
case 1: case 1:
case 4: case 4:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 1 or 4 bmp -> pal 1 dib ==== */ /* ==== pal 1 or 4 bmp -> pal 1 dib ==== */
BYTE* dstbyte; BYTE* dstbyte;
...@@ -634,7 +647,8 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, ...@@ -634,7 +647,8 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits,
break; break;
case 8: case 8:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask, bmpImage->green_mask, bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 8 bmp -> pal 1 dib ==== */ /* ==== pal 8 bmp -> pal 1 dib ==== */
const void* srcbits; const void* srcbits;
const BYTE* srcpixel; const BYTE* srcpixel;
...@@ -978,7 +992,8 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, ...@@ -978,7 +992,8 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits,
switch (bmpImage->depth) { switch (bmpImage->depth) {
case 1: case 1:
case 4: case 4:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 1 or 4 bmp -> pal 4 dib ==== */ /* ==== pal 1 or 4 bmp -> pal 4 dib ==== */
BYTE* dstbyte; BYTE* dstbyte;
...@@ -1010,7 +1025,8 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, ...@@ -1010,7 +1025,8 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits,
break; break;
case 8: case 8:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 8 bmp -> pal 4 dib ==== */ /* ==== pal 8 bmp -> pal 4 dib ==== */
const void* srcbits; const void* srcbits;
const BYTE *srcpixel; const BYTE *srcpixel;
...@@ -1568,7 +1584,8 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, ...@@ -1568,7 +1584,8 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits,
switch (bmpImage->depth) { switch (bmpImage->depth) {
case 1: case 1:
case 4: case 4:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 1 bmp -> pal 8 dib ==== */ /* ==== pal 1 bmp -> pal 8 dib ==== */
/* ==== pal 4 bmp -> pal 8 dib ==== */ /* ==== pal 4 bmp -> pal 8 dib ==== */
...@@ -1590,7 +1607,8 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, ...@@ -1590,7 +1607,8 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits,
break; break;
case 8: case 8:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 8 bmp -> pal 8 dib ==== */ /* ==== pal 8 bmp -> pal 8 dib ==== */
const void* srcbits; const void* srcbits;
const BYTE* srcpixel; const BYTE* srcpixel;
...@@ -2374,7 +2392,8 @@ static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits, ...@@ -2374,7 +2392,8 @@ static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits,
case 1: case 1:
case 4: case 4:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 1 or 4 bmp -> rgb or bgr 555 or 565 dib ==== */ /* ==== pal 1 or 4 bmp -> rgb or bgr 555 or 565 dib ==== */
int rShift,gShift,bShift; int rShift,gShift,bShift;
WORD* dstpixel; WORD* dstpixel;
...@@ -2412,7 +2431,8 @@ static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits, ...@@ -2412,7 +2431,8 @@ static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits,
break; break;
case 8: case 8:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 8 bmp -> rgb or bgr 555 or 565 dib ==== */ /* ==== pal 8 bmp -> rgb or bgr 555 or 565 dib ==== */
int rShift,gShift,bShift; int rShift,gShift,bShift;
const BYTE* srcbits; const BYTE* srcbits;
...@@ -2799,7 +2819,8 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits, ...@@ -2799,7 +2819,8 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits,
case 1: case 1:
case 4: case 4:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 1 or 4 bmp -> rgb 888 dib ==== */ /* ==== pal 1 or 4 bmp -> rgb 888 dib ==== */
BYTE* dstbyte; BYTE* dstbyte;
...@@ -2822,7 +2843,8 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits, ...@@ -2822,7 +2843,8 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits,
break; break;
case 8: case 8:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask == 0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 8 bmp -> rgb 888 dib ==== */ /* ==== pal 8 bmp -> rgb 888 dib ==== */
const void* srcbits; const void* srcbits;
const BYTE* srcpixel; const BYTE* srcpixel;
...@@ -3377,7 +3399,8 @@ static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits, ...@@ -3377,7 +3399,8 @@ static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits,
case 1: case 1:
case 4: case 4:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 1 or 4 bmp -> any 0888 dib ==== */ /* ==== pal 1 or 4 bmp -> any 0888 dib ==== */
int rShift,gShift,bShift; int rShift,gShift,bShift;
DWORD* dstpixel; DWORD* dstpixel;
...@@ -3402,7 +3425,8 @@ static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits, ...@@ -3402,7 +3425,8 @@ static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits,
break; break;
case 8: case 8:
if (bmpImage->red_mask==0 && bmpImage->green_mask==0 && bmpImage->blue_mask==0 && srccolors) { if (X11DRV_DIB_CheckMask(bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask)
&& srccolors) {
/* ==== pal 8 bmp -> any 0888 dib ==== */ /* ==== pal 8 bmp -> any 0888 dib ==== */
int rShift,gShift,bShift; int rShift,gShift,bShift;
const void* srcbits; const void* srcbits;
......
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