Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
244762bb
Commit
244762bb
authored
Aug 17, 2005
by
Christian Costa
Committed by
Alexandre Julliard
Aug 17, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take RGB mask into account when doing color keying.
Add corresponding conformance test.
parent
4fd3f409
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
4 deletions
+73
-4
surface_dib.c
dlls/ddraw/surface_dib.c
+5
-4
dsurface.c
dlls/ddraw/tests/dsurface.c
+68
-0
No files found.
dlls/ddraw/surface_dib.c
View file @
244762bb
...
...
@@ -819,7 +819,7 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
}
}
else
{
LONG
dstyinc
=
ddesc
.
u1
.
lPitch
,
dstxinc
=
bpp
;
DWORD
keylow
=
0
,
keyhigh
=
0
;
DWORD
keylow
=
0
,
keyhigh
=
0
,
keymask
=
0
;
if
(
dwFlags
&
(
DDBLT_KEYSRC
|
DDBLT_KEYDEST
|
DDBLT_KEYSRCOVERRIDE
|
DDBLT_KEYDESTOVERRIDE
))
{
if
(
dwFlags
&
DDBLT_KEYSRC
)
{
...
...
@@ -835,7 +835,8 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
keylow
=
lpbltfx
->
ddckDestColorkey
.
dwColorSpaceLowValue
;
keyhigh
=
lpbltfx
->
ddckDestColorkey
.
dwColorSpaceHighValue
;
}
dwFlags
&=
~
(
DDBLT_KEYSRC
|
DDBLT_KEYDEST
|
DDBLT_KEYSRCOVERRIDE
|
DDBLT_KEYDESTOVERRIDE
);
keymask
=
sdesc
.
u4
.
ddpfPixelFormat
.
u2
.
dwRBitMask
|
sdesc
.
u4
.
ddpfPixelFormat
.
u3
.
dwGBitMask
|
sdesc
.
u4
.
ddpfPixelFormat
.
u4
.
dwBBitMask
;
dwFlags
&=
~
(
DDBLT_KEYSRC
|
DDBLT_KEYDEST
|
DDBLT_KEYSRCOVERRIDE
|
DDBLT_KEYDESTOVERRIDE
);
}
if
(
dwFlags
&
DDBLT_DDFX
)
{
...
...
@@ -919,7 +920,7 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
dx = d; \
for (x = sx = 0; x < dstwidth; x++, sx += xinc) { \
tmp = s[sx >> 16]; \
if (
tmp < keylow || tmp
> keyhigh) dx[0] = tmp; \
if (
(tmp & keymask) < keylow || (tmp & keymask)
> keyhigh) dx[0] = tmp; \
dx = (type*)(((LPBYTE)dx)+dstxinc); \
} \
d = (type*)(((LPBYTE)d)+dstyinc); \
...
...
@@ -938,7 +939,7 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
DWORD
pixel
;
s
=
sbuf
+
3
*
(
sx
>>
16
);
pixel
=
s
[
0
]
|
(
s
[
1
]
<<
8
)
|
(
s
[
2
]
<<
16
);
if
(
pixel
<
keylow
||
pixel
>
keyhigh
)
{
if
(
(
pixel
&
keymask
)
<
keylow
||
(
pixel
&
keymask
)
>
keyhigh
)
{
dx
[
0
]
=
(
pixel
)
&
0xff
;
dx
[
1
]
=
(
pixel
>>
8
)
&
0xff
;
dx
[
2
]
=
(
pixel
>>
16
)
&
0xff
;
...
...
dlls/ddraw/tests/dsurface.c
View file @
244762bb
...
...
@@ -2,6 +2,7 @@
* Unit tests for (a few) ddraw surface functions
*
* Copyright (C) 2005 Antoine Chavasse (a.chavasse@gmail.com)
* Copyright (C) 2005 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -153,10 +154,77 @@ static void MipMapCreationTest(void)
IDirectDrawSurface_Release
(
lpDDSMipMapTest
);
}
static
void
SrcColorKey32BlitTest
(
void
)
{
LPDIRECTDRAWSURFACE
lpSrc
;
LPDIRECTDRAWSURFACE
lpDst
;
DDSURFACEDESC
ddsd
;
DDSURFACEDESC
ddsd2
;
LPDWORD
lpData
;
HRESULT
rc
;
ddsd2
.
dwSize
=
sizeof
(
ddsd2
);
ddsd2
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd2
.
ddpfPixelFormat
);
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
ddsd
.
dwWidth
=
800
;
ddsd
.
dwHeight
=
600
;
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0xFF0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x00FF00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x0000FF
;
rc
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd
,
&
lpDst
,
NULL
);
ok
(
rc
==
DD_OK
,
"CreateSurface returned: %lx
\n
"
,
rc
);
ddsd
.
dwFlags
|=
DDSD_CKSRCBLT
;
ddsd
.
ddckCKSrcBlt
.
dwColorSpaceLowValue
=
0xFF00FF
;
ddsd
.
ddckCKSrcBlt
.
dwColorSpaceHighValue
=
0xFF00FF
;
rc
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd
,
&
lpSrc
,
NULL
);
ok
(
rc
==
DD_OK
,
"CreateSurface returned: %lx
\n
"
,
rc
);
rc
=
IDirectDrawSurface_Lock
(
lpDst
,
NULL
,
&
ddsd2
,
DDLOCK_WAIT
,
NULL
);
ok
(
rc
==
DD_OK
,
"Lock returned: %lx
\n
"
,
rc
);
lpData
=
(
LPDWORD
)
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: %lx
\n
"
,
rc
);
rc
=
IDirectDrawSurface_Lock
(
lpSrc
,
NULL
,
&
ddsd2
,
DDLOCK_WAIT
,
NULL
);
ok
(
rc
==
DD_OK
,
"Lock returned: %lx
\n
"
,
rc
);
lpData
=
(
LPDWORD
)
ddsd2
.
lpSurface
;
lpData
[
0
]
=
0x77010203
;
lpData
[
1
]
=
0x00010203
;
lpData
[
2
]
=
0x77FF00FF
;
lpData
[
3
]
=
0x00FF00FF
;
rc
=
IDirectDrawSurface_Unlock
(
lpSrc
,
NULL
);
ok
(
rc
==
DD_OK
,
"Unlock returned: %lx
\n
"
,
rc
);
IDirectDrawSurface_Blt
(
lpDst
,
NULL
,
lpSrc
,
NULL
,
DDBLT_KEYSRC
,
NULL
);
rc
=
IDirectDrawSurface_Lock
(
lpDst
,
NULL
,
&
ddsd2
,
DDLOCK_WAIT
,
NULL
);
ok
(
rc
==
DD_OK
,
"Lock returned: %lx
\n
"
,
rc
);
lpData
=
(
LPDWORD
)
ddsd2
.
lpSurface
;
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: %lx
\n
"
,
rc
);
IDirectDrawSurface_Release
(
lpSrc
);
IDirectDrawSurface_Release
(
lpDst
);
}
START_TEST
(
dsurface
)
{
CreateDirectDraw
();
MipMapCreationTest
();
SrcColorKey32BlitTest
();
ReleaseDirectDraw
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment