wined3d: Fix a bug in BtlFast which was uncovered by the 32-bit dibsection support.
This commit is contained in:
parent
60ddb1365d
commit
6d8c4572ef
|
@ -304,6 +304,40 @@ static void SrcColorKey32BlitTest(void)
|
|||
rc = IDirectDrawSurface_Unlock(lpDst, NULL);
|
||||
ok(rc==DD_OK,"Unlock returned: %x\n",rc);
|
||||
|
||||
/* Below we repeat the same test as above but now using BltFast instead of Blt. Before
|
||||
* we can carry out the test we need to restore the color of the destination surface.
|
||||
*/
|
||||
rc = IDirectDrawSurface_Lock(lpDst, NULL, &ddsd2, DDLOCK_WAIT, NULL);
|
||||
ok(rc==DD_OK,"Lock returned: %x\n",rc);
|
||||
lpData = ddsd2.lpSurface;
|
||||
lpData[0] = 0xCCCCCCCC;
|
||||
lpData[1] = 0xCCCCCCCC;
|
||||
lpData[2] = 0xCCCCCCCC;
|
||||
lpData[3] = 0xCCCCCCCC;
|
||||
rc = IDirectDrawSurface_Unlock(lpDst, NULL);
|
||||
ok(rc==DD_OK,"Unlock returned: %x\n",rc);
|
||||
|
||||
IDirectDrawSurface_BltFast(lpDst, 0, 0, lpSrc, NULL, DDBLTFAST_SRCCOLORKEY);
|
||||
|
||||
rc = IDirectDrawSurface_Lock(lpDst, NULL, &ddsd2, DDLOCK_WAIT, NULL);
|
||||
ok(rc==DD_OK,"Lock returned: %x\n",rc);
|
||||
ok((ddsd2.dwFlags & DDSD_LPSURFACE) == 0, "Surface desc has LPSURFACE Flags set\n");
|
||||
lpData = ddsd2.lpSurface;
|
||||
/* Different behavior on some drivers / windows versions. Some versions ignore the X channel when
|
||||
* color keying, but copy it to the destination surface. Others apply it for color keying, but
|
||||
* do not copy it into the destination surface.
|
||||
*/
|
||||
if(lpData[0]==0x00010203) {
|
||||
trace("X channel was not copied into the destination surface\n");
|
||||
ok((lpData[0]==0x00010203)&&(lpData[1]==0x00010203)&&(lpData[2]==0x00FF00FF)&&(lpData[3]==0xCCCCCCCC),
|
||||
"Destination data after blitting is not correct\n");
|
||||
} else {
|
||||
ok((lpData[0]==0x77010203)&&(lpData[1]==0x00010203)&&(lpData[2]==0xCCCCCCCC)&&(lpData[3]==0xCCCCCCCC),
|
||||
"Destination data after blitting is not correct\n");
|
||||
}
|
||||
rc = IDirectDrawSurface_Unlock(lpDst, NULL);
|
||||
ok(rc==DD_OK,"Unlock returned: %x\n",rc);
|
||||
|
||||
/* Also test SetColorKey */
|
||||
IDirectDrawSurface_GetColorKey(lpSrc, DDCKEY_SRCBLT, &DDColorKey);
|
||||
ok(DDColorKey.dwColorSpaceLowValue == 0xFF00FF && DDColorKey.dwColorSpaceHighValue == 0xFF00FF,
|
||||
|
|
|
@ -1695,6 +1695,14 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
|
|||
if (trans & (WINEDDBLTFAST_SRCCOLORKEY | WINEDDBLTFAST_DESTCOLORKEY))
|
||||
{
|
||||
DWORD keylow, keyhigh;
|
||||
DWORD mask = Src->resource.format_desc->red_mask |
|
||||
Src->resource.format_desc->green_mask |
|
||||
Src->resource.format_desc->blue_mask;
|
||||
|
||||
/* For some 8-bit formats like L8 and P8 color masks don't make sense */
|
||||
if(!mask && bpp==1)
|
||||
mask = 0xff;
|
||||
|
||||
TRACE("Color keyed copy\n");
|
||||
if (trans & WINEDDBLTFAST_SRCCOLORKEY)
|
||||
{
|
||||
|
@ -1716,7 +1724,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
|
|||
for (y = 0; y < h; y++) { \
|
||||
for (x = 0; x < w; x++) { \
|
||||
tmp = s[x]; \
|
||||
if (tmp < keylow || tmp > keyhigh) d[x] = tmp; \
|
||||
if ((tmp & mask) < keylow || (tmp & mask) > keyhigh) d[x] = tmp; \
|
||||
} \
|
||||
s = (const type *)((const BYTE *)s + slock.Pitch); \
|
||||
d = (type *)((BYTE *)d + dlock.Pitch); \
|
||||
|
|
Loading…
Reference in New Issue