Support for 24bpp when DDBLT_KEYSRC etc are set

Lionel Ulmer lionel.ulmer at free.fr
Tue Jul 9 15:41:21 CDT 2002


> Change log: added support for 24bpp when  the flags 
> DDBLT_KEYSRC/DDBLT_KEYDEST and company are set.

Well, I have the following comment :

> + 	    case 3: {
> +		int last_sy = -1;
> +		for (y = sy = 0; y < dstheight; y++, sy += yinc) {
> +		    sbuf = sbase + (sy >> 16) * sdesc.u1.lPitch;
> +		    if ((sy >> 16) == (last_sy >> 16)) {
> +			/* this sourcerow is the same as last sourcerow -
> +			 * copy already stretched row
> +			 */
> +			memcpy(dbuf, dbuf - ddesc.u1.lPitch, width);

Are you sure that this works ? If you have pixels in the destination surface
that are NOT overwritten by the source surface (due to color-keying) you
should not copy these from one line to the other.

> +		    } else {
> +			LPBYTE s,d = dbuf;
> +			for (x = sx = 0; x < dstwidth; x++, sx+= xinc) {
> +			    DWORD pixel;
> +
> +			    s = sbuf+3*(sx>>16);
> +			    pixel = (s[0]<<16)|(s[1]<<8)|s[2];
> +                            if (pixel < keylow || pixel > keyhigh){
> +			       d[0] = (pixel>>16)&0xff;
> +			       d[1] = (pixel>> 8)&0xff;
> +			       d[2] = (pixel    )&0xff;
> +			       d+=3;

Why only increase the destination pixel when the color is not keyed off ?

> +                            }
> +			}
> +		    }
> +		    dbuf += ddesc.u1.lPitch;
> +		    last_sy = sy;
> +                }
> +                break;}

The rest of the patch looks OK :)

By the way, which game uses 24 bpp ? It's *EVIL* :-)

                           Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/



More information about the wine-devel mailing list