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
616ea532
Commit
616ea532
authored
Dec 16, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Add a test for IDirectDrawSurface::GetDC.
parent
6a548b1e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
5 deletions
+104
-5
surface.c
dlls/d3d9/surface.c
+4
-1
dsurface.c
dlls/ddraw/tests/dsurface.c
+96
-0
surface.c
dlls/wined3d/surface.c
+2
-2
surface_gdi.c
dlls/wined3d/surface_gdi.c
+2
-2
No files found.
dlls/d3d9/surface.c
View file @
616ea532
...
...
@@ -263,7 +263,10 @@ static HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface,
EnterCriticalSection
(
&
d3d9_cs
);
hr
=
IWineD3DSurface_ReleaseDC
(
This
->
wineD3DSurface
,
hdc
);
LeaveCriticalSection
(
&
d3d9_cs
);
return
hr
;
switch
(
hr
)
{
case
WINEDDERR_NODC
:
return
WINED3DERR_INVALIDCALL
;
default:
return
hr
;
}
}
...
...
dlls/ddraw/tests/dsurface.c
View file @
616ea532
...
...
@@ -2764,6 +2764,101 @@ static BOOL can_create_primary_surface(void)
return
TRUE
;
}
static
void
dctest_surf
(
IDirectDrawSurface
*
surf
,
int
ddsdver
)
{
HRESULT
hr
;
HDC
dc
,
dc2
=
(
HDC
)
0x1234
;
DDSURFACEDESC
ddsd
;
DDSURFACEDESC2
ddsd2
;
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
memset
(
&
ddsd2
,
0
,
sizeof
(
ddsd2
));
ddsd2
.
dwSize
=
sizeof
(
ddsd2
);
hr
=
IDirectDrawSurface_GetDC
(
surf
,
&
dc
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface_GetDC failed: 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_GetDC
(
surf
,
&
dc2
);
ok
(
hr
==
DDERR_DCALREADYCREATED
,
"IDirectDrawSurface_GetDC failed: 0x%08x
\n
"
,
hr
);
ok
(
dc2
==
(
HDC
)
0x1234
,
"The failed GetDC call changed the dc: %p
\n
"
,
dc2
);
hr
=
IDirectDrawSurface_Lock
(
surf
,
NULL
,
ddsdver
==
1
?
&
ddsd
:
((
DDSURFACEDESC
*
)
&
ddsd2
),
0
,
NULL
);
ok
(
hr
==
DDERR_SURFACEBUSY
,
"IDirectDrawSurface_Lock returned 0x%08x, expected DDERR_ALREADYLOCKED
\n
"
,
hr
);
hr
=
IDirectDrawSurface_ReleaseDC
(
surf
,
dc
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface_ReleaseDC failed: 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_ReleaseDC
(
surf
,
dc
);
ok
(
hr
==
DDERR_NODC
,
"IDirectDrawSurface_ReleaseDC returned 0x%08x, expected DDERR_NODC
\n
"
,
hr
);
}
static
void
GetDCTest
(
void
)
{
DDSURFACEDESC
ddsd
;
DDSURFACEDESC2
ddsd2
;
IDirectDrawSurface
*
surf
;
IDirectDrawSurface2
*
surf2
;
IDirectDrawSurface4
*
surf4
;
IDirectDrawSurface7
*
surf7
;
HRESULT
hr
;
IDirectDraw2
*
dd2
;
IDirectDraw4
*
dd4
;
IDirectDraw7
*
dd7
;
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
dwWidth
=
64
;
ddsd
.
dwHeight
=
64
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
memset
(
&
ddsd2
,
0
,
sizeof
(
ddsd2
));
ddsd2
.
dwSize
=
sizeof
(
ddsd2
);
ddsd2
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd2
.
dwWidth
=
64
;
ddsd2
.
dwHeight
=
64
;
ddsd2
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd
,
&
surf
,
NULL
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_CreateSurface failed: 0x%08x
\n
"
,
hr
);
dctest_surf
(
surf
,
1
);
IDirectDrawSurface_Release
(
surf
);
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw2
,
(
void
**
)
&
dd2
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_QueryInterface failed: 0x%08x
\n
"
,
hr
);
hr
=
IDirectDraw2_CreateSurface
(
dd2
,
&
ddsd
,
&
surf
,
NULL
);
ok
(
hr
==
DD_OK
,
"IDirectDraw2_CreateSurface failed: 0x%08x
\n
"
,
hr
);
dctest_surf
(
surf
,
1
);
hr
=
IDirectDrawSurface_QueryInterface
(
surf
,
&
IID_IDirectDrawSurface2
,
(
void
**
)
&
surf2
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface_QueryInterface failed: 0x%08x
\n
"
,
hr
);
dctest_surf
((
IDirectDrawSurface
*
)
surf2
,
1
);
IDirectDrawSurface2_Release
(
surf2
);
IDirectDrawSurface_Release
(
surf
);
IDirectDraw2_Release
(
dd2
);
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw4
,
(
void
**
)
&
dd4
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_QueryInterface failed: 0x%08x
\n
"
,
hr
);
surf
=
NULL
;
hr
=
IDirectDraw4_CreateSurface
(
dd4
,
&
ddsd2
,
&
surf4
,
NULL
);
ok
(
hr
==
DD_OK
,
"IDirectDraw4_CreateSurface failed: 0x%08x
\n
"
,
hr
);
dctest_surf
((
IDirectDrawSurface
*
)
surf4
,
2
);
IDirectDrawSurface4_Release
(
surf4
);
IDirectDraw4_Release
(
dd4
);
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw7
,
(
void
**
)
&
dd7
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_QueryInterface failed: 0x%08x
\n
"
,
hr
);
surf
=
NULL
;
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd2
,
&
surf7
,
NULL
);
ok
(
hr
==
DD_OK
,
"IDirectDraw7_CreateSurface failed: 0x%08x
\n
"
,
hr
);
dctest_surf
((
IDirectDrawSurface
*
)
surf7
,
2
);
IDirectDrawSurface7_Release
(
surf7
);
IDirectDraw7_Release
(
dd7
);
}
START_TEST
(
dsurface
)
{
HRESULT
ret
;
...
...
@@ -2806,5 +2901,6 @@ START_TEST(dsurface)
StructSizeTest
();
PaletteTest
();
SurfaceCapsTest
();
GetDCTest
();
ReleaseDirectDraw
();
}
dlls/wined3d/surface.c
View file @
616ea532
...
...
@@ -1527,11 +1527,11 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
hDC
);
if
(
!
(
This
->
Flags
&
SFLAG_DCINUSE
))
return
WINED
3DERR_INVALIDCALL
;
return
WINED
DERR_NODC
;
if
(
This
->
hDC
!=
hDC
)
{
WARN
(
"Application tries to release an invalid DC(%p), surface dc is %p
\n
"
,
hDC
,
This
->
hDC
);
return
WINED
3DERR_INVALIDCALL
;
return
WINED
DERR_NODC
;
}
if
((
This
->
Flags
&
SFLAG_PBO
)
&&
This
->
resource
.
allocatedMemory
)
{
...
...
dlls/wined3d/surface_gdi.c
View file @
616ea532
...
...
@@ -442,11 +442,11 @@ static HRESULT WINAPI IWineGDISurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
hDC
);
if
(
!
(
This
->
Flags
&
SFLAG_DCINUSE
))
return
WINED
3DERR_INVALIDCALL
;
return
WINED
DERR_NODC
;
if
(
This
->
hDC
!=
hDC
)
{
WARN
(
"Application tries to release an invalid DC(%p), surface dc is %p
\n
"
,
hDC
,
This
->
hDC
);
return
WINED
3DERR_INVALIDCALL
;
return
WINED
DERR_NODC
;
}
/* we locked first, so unlock now */
...
...
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