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
6e7bb649
Commit
6e7bb649
authored
Nov 03, 2011
by
Octavian Voicu
Committed by
Alexandre Julliard
Nov 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Move surface attachment tests from refcount.c to dsurface.c.
parent
8c41a3bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
104 deletions
+133
-104
dsurface.c
dlls/ddraw/tests/dsurface.c
+130
-1
refcount.c
dlls/ddraw/tests/refcount.c
+3
-103
No files found.
dlls/ddraw/tests/dsurface.c
View file @
6e7bb649
...
@@ -1239,7 +1239,9 @@ static void AttachmentTest7(void)
...
@@ -1239,7 +1239,9 @@ static void AttachmentTest7(void)
HRESULT
hr
;
HRESULT
hr
;
IDirectDraw7
*
dd7
;
IDirectDraw7
*
dd7
;
IDirectDrawSurface7
*
surface1
,
*
surface2
,
*
surface3
,
*
surface4
;
IDirectDrawSurface7
*
surface1
,
*
surface2
,
*
surface3
,
*
surface4
;
IDirectDrawSurface
*
surface1v1
,
*
surface2v1
;
DDSURFACEDESC2
ddsd
,
ddsd2
;
DDSURFACEDESC2
ddsd
,
ddsd2
;
DWORD
ref
;
UINT
num
;
UINT
num
;
DDSCAPS2
caps
=
{
DDSCAPS_TEXTURE
,
0
,
0
,
0
},
caps2
=
{
DDSCAPS_BACKBUFFER
,
0
,
0
,
0
};
DDSCAPS2
caps
=
{
DDSCAPS_TEXTURE
,
0
,
0
,
0
},
caps2
=
{
DDSCAPS_BACKBUFFER
,
0
,
0
,
0
};
HWND
window
=
CreateWindow
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
HWND
window
=
CreateWindow
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
...
@@ -1417,6 +1419,73 @@ static void AttachmentTest7(void)
...
@@ -1417,6 +1419,73 @@ static void AttachmentTest7(void)
IDirectDrawSurface7_Release
(
surface2
);
IDirectDrawSurface7_Release
(
surface2
);
IDirectDrawSurface7_Release
(
surface1
);
IDirectDrawSurface7_Release
(
surface1
);
/* Test DeleteAttachedSurface and automatic detachment of attached surfaces on release */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
64
;
ddsd
.
dwHeight
=
64
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
|
DDSCAPS_3DDEVICE
;
U4
(
ddsd
).
ddpfPixelFormat
.
dwSize
=
sizeof
(
U4
(
ddsd
).
ddpfPixelFormat
);
U4
(
ddsd
).
ddpfPixelFormat
.
dwFlags
=
DDPF_PALETTEINDEXED8
|
DDPF_RGB
;
U1
(
U4
(
ddsd
).
ddpfPixelFormat
).
dwRGBBitCount
=
8
;
memset
(
&
ddsd2
,
0
,
sizeof
(
ddsd2
));
ddsd2
.
dwSize
=
sizeof
(
ddsd2
);
ddsd2
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
ddsd2
.
dwWidth
=
ddsd
.
dwWidth
;
ddsd2
.
dwHeight
=
ddsd
.
dwHeight
;
ddsd2
.
ddsCaps
.
dwCaps
=
DDSCAPS_3DDEVICE
|
DDSCAPS_ZBUFFER
;
U4
(
ddsd2
).
ddpfPixelFormat
.
dwSize
=
sizeof
(
U4
(
ddsd2
).
ddpfPixelFormat
);
U4
(
ddsd2
).
ddpfPixelFormat
.
dwFlags
=
DDPF_ZBUFFER
;
U1
(
U4
(
ddsd2
).
ddpfPixelFormat
).
dwZBufferBitDepth
=
16
;
U3
(
U4
(
ddsd2
).
ddpfPixelFormat
).
dwZBitMask
=
0x0000FFFF
;
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd
,
&
surface1
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd2
,
&
surface2
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* DeleteAttachedSurface */
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface1
,
surface2
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
hr
=
IDirectDrawSurface7_QueryInterface
(
surface1
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
surface1v1
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface7_QueryInterface returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_QueryInterface
(
surface2
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
surface2v1
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface7_QueryInterface returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface1v1
,
0
,
surface2v1
);
ok
(
hr
==
DDERR_SURFACENOTATTACHED
,
"DeleteAttachedSurface returned %08x
\n
"
,
hr
);
if
(
surface2v1
!=
NULL
)
IDirectDrawSurface_Release
(
surface2v1
);
if
(
surface1v1
!=
NULL
)
IDirectDrawSurface_Release
(
surface1v1
);
hr
=
IDirectDrawSurface7_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
ok
(
hr
==
DD_OK
,
"DeleteAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
}
/* Automatic detachment on release */
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface1
,
surface2
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
ref
=
IDirectDrawSurface7_Release
(
surface1
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
ref
=
IDirectDrawSurface7_Release
(
surface2
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
}
else
IDirectDrawSurface7_Release
(
surface1
);
}
hr
=
IDirectDraw7_SetCooperativeLevel
(
dd7
,
NULL
,
DDSCL_NORMAL
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
dd7
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
IDirectDraw7_Release
(
dd7
);
IDirectDraw7_Release
(
dd7
);
...
@@ -1426,7 +1495,8 @@ static void AttachmentTest(void)
...
@@ -1426,7 +1495,8 @@ static void AttachmentTest(void)
{
{
HRESULT
hr
;
HRESULT
hr
;
IDirectDrawSurface
*
surface1
,
*
surface2
,
*
surface3
,
*
surface4
;
IDirectDrawSurface
*
surface1
,
*
surface2
,
*
surface3
,
*
surface4
;
DDSURFACEDESC
ddsd
;
DDSURFACEDESC
ddsd
,
ddsd2
;
DWORD
ref
;
DDSCAPS
caps
=
{
DDSCAPS_TEXTURE
};
DDSCAPS
caps
=
{
DDSCAPS_TEXTURE
};
BOOL
refrast
=
FALSE
;
BOOL
refrast
=
FALSE
;
HWND
window
=
CreateWindow
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
HWND
window
=
CreateWindow
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
...
@@ -1623,6 +1693,65 @@ static void AttachmentTest(void)
...
@@ -1623,6 +1693,65 @@ static void AttachmentTest(void)
IDirectDrawSurface_Release
(
surface2
);
IDirectDrawSurface_Release
(
surface2
);
IDirectDrawSurface_Release
(
surface1
);
IDirectDrawSurface_Release
(
surface1
);
/* Test DeleteAttachedSurface and automatic detachment of attached surfaces on release */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
64
;
ddsd
.
dwHeight
=
64
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
|
DDSCAPS_3DDEVICE
;
U4
(
ddsd
).
ddpfPixelFormat
.
dwSize
=
sizeof
(
U4
(
ddsd
).
ddpfPixelFormat
);
U4
(
ddsd
).
ddpfPixelFormat
.
dwFlags
=
DDPF_PALETTEINDEXED8
|
DDPF_RGB
;
U1
(
U4
(
ddsd
).
ddpfPixelFormat
).
dwRGBBitCount
=
8
;
memset
(
&
ddsd2
,
0
,
sizeof
(
ddsd2
));
ddsd2
.
dwSize
=
sizeof
(
ddsd2
);
ddsd2
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
ddsd2
.
dwWidth
=
ddsd
.
dwWidth
;
ddsd2
.
dwHeight
=
ddsd
.
dwHeight
;
ddsd2
.
ddsCaps
.
dwCaps
=
DDSCAPS_3DDEVICE
|
DDSCAPS_ZBUFFER
;
U4
(
ddsd2
).
ddpfPixelFormat
.
dwSize
=
sizeof
(
U4
(
ddsd2
).
ddpfPixelFormat
);
U4
(
ddsd2
).
ddpfPixelFormat
.
dwFlags
=
DDPF_ZBUFFER
;
U1
(
U4
(
ddsd2
).
ddpfPixelFormat
).
dwZBufferBitDepth
=
16
;
U3
(
U4
(
ddsd2
).
ddpfPixelFormat
).
dwZBitMask
=
0x0000FFFF
;
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
(
DDSURFACEDESC
*
)
&
ddsd
,
&
surface1
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
(
DDSURFACEDESC
*
)
&
ddsd2
,
&
surface2
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* DeleteAttachedSurface */
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface1
,
surface2
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
ok
(
hr
==
DD_OK
,
"DeleteAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
}
/* Automatic detachment on release */
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface1
,
surface2
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
ref
=
IDirectDrawSurface_Release
(
surface1
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
ref
=
getRefcount
((
IUnknown
*
)
surface2
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
ref
=
IDirectDrawSurface_Release
(
surface2
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
}
else
IDirectDrawSurface_Release
(
surface1
);
}
hr
=
IDirectDraw_SetCooperativeLevel
(
lpDD
,
NULL
,
DDSCL_NORMAL
);
hr
=
IDirectDraw_SetCooperativeLevel
(
lpDD
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
...
...
dlls/ddraw/tests/refcount.c
View file @
6e7bb649
...
@@ -47,11 +47,11 @@ static void test_ddraw_objects(void)
...
@@ -47,11 +47,11 @@ static void test_ddraw_objects(void)
IDirectDraw2
*
DDraw2
;
IDirectDraw2
*
DDraw2
;
IDirectDraw
*
DDraw1
;
IDirectDraw
*
DDraw1
;
IDirectDrawPalette
*
palette
;
IDirectDrawPalette
*
palette
;
IDirectDrawSurface7
*
surface
=
NULL
,
*
stencil
;
IDirectDrawSurface7
*
surface
=
NULL
;
IDirectDrawSurface
*
surface1
,
*
stencil1
;
IDirectDrawSurface
*
surface1
;
IDirectDrawSurface4
*
surface4
;
IDirectDrawSurface4
*
surface4
;
PALETTEENTRY
Table
[
256
];
PALETTEENTRY
Table
[
256
];
DDSURFACEDESC2
ddsd
,
ddsd_stencil
;
DDSURFACEDESC2
ddsd
;
hr
=
pDirectDrawCreateEx
(
NULL
,
(
void
**
)
&
DDraw7
,
&
IID_IDirectDraw7
,
NULL
);
hr
=
pDirectDrawCreateEx
(
NULL
,
(
void
**
)
&
DDraw7
,
&
IID_IDirectDraw7
,
NULL
);
ok
(
hr
==
DD_OK
||
hr
==
DDERR_NODIRECTDRAWSUPPORT
,
"DirectDrawCreateEx returned: %x
\n
"
,
hr
);
ok
(
hr
==
DD_OK
||
hr
==
DDERR_NODIRECTDRAWSUPPORT
,
"DirectDrawCreateEx returned: %x
\n
"
,
hr
);
...
@@ -92,17 +92,6 @@ static void test_ddraw_objects(void)
...
@@ -92,17 +92,6 @@ static void test_ddraw_objects(void)
U4
(
ddsd
).
ddpfPixelFormat
.
dwFlags
=
DDPF_PALETTEINDEXED8
|
DDPF_RGB
;
U4
(
ddsd
).
ddpfPixelFormat
.
dwFlags
=
DDPF_PALETTEINDEXED8
|
DDPF_RGB
;
U1
(
U4
(
ddsd
).
ddpfPixelFormat
).
dwRGBBitCount
=
8
;
U1
(
U4
(
ddsd
).
ddpfPixelFormat
).
dwRGBBitCount
=
8
;
memset
(
&
ddsd_stencil
,
0
,
sizeof
(
ddsd_stencil
));
ddsd_stencil
.
dwSize
=
sizeof
(
ddsd_stencil
);
ddsd_stencil
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
ddsd_stencil
.
dwWidth
=
ddsd
.
dwWidth
;
ddsd_stencil
.
dwHeight
=
ddsd
.
dwHeight
;
ddsd_stencil
.
ddsCaps
.
dwCaps
=
DDSCAPS_3DDEVICE
|
DDSCAPS_ZBUFFER
;
U4
(
ddsd_stencil
).
ddpfPixelFormat
.
dwSize
=
sizeof
(
U4
(
ddsd_stencil
).
ddpfPixelFormat
);
U4
(
ddsd_stencil
).
ddpfPixelFormat
.
dwFlags
=
DDPF_ZBUFFER
;
U1
(
U4
(
ddsd_stencil
).
ddpfPixelFormat
).
dwZBufferBitDepth
=
16
;
U3
(
U4
(
ddsd_stencil
).
ddpfPixelFormat
).
dwZBitMask
=
0x0000FFFF
;
hr
=
IDirectDraw7_CreateSurface
(
DDraw7
,
&
ddsd
,
&
surface
,
NULL
);
hr
=
IDirectDraw7_CreateSurface
(
DDraw7
,
&
ddsd
,
&
surface
,
NULL
);
if
(
!
surface
)
if
(
!
surface
)
{
{
...
@@ -197,95 +186,6 @@ static void test_ddraw_objects(void)
...
@@ -197,95 +186,6 @@ static void test_ddraw_objects(void)
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
IDirectDrawSurface_Release
(
surface1
);
IDirectDrawSurface_Release
(
surface1
);
/* AddAttachedSurface with IDirectDrawSurface7 */
ddsd
.
dwSize
=
sizeof
(
DDSURFACEDESC2
);
ddsd
.
ddsCaps
.
dwCaps
|=
DDSCAPS_3DDEVICE
;
hr
=
IDirectDraw7_CreateSurface
(
DDraw7
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ddsd_stencil
.
dwSize
=
sizeof
(
DDSURFACEDESC2
);
hr
=
IDirectDraw7_CreateSurface
(
DDraw7
,
&
ddsd_stencil
,
&
stencil
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* AddAttachedSurface with DeleteAttachedSurface */
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface
,
stencil
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ref
=
getRefcount
(
(
IUnknown
*
)
stencil
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
hr
=
IDirectDrawSurface7_QueryInterface
(
surface
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
surface1
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface7_QueryInterface returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_QueryInterface
(
stencil
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
stencil1
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface7_QueryInterface returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface1
,
0
,
stencil1
);
ok
(
hr
==
DDERR_SURFACENOTATTACHED
,
"DeleteAttachedSurface returned %08x
\n
"
,
hr
);
if
(
stencil1
!=
NULL
)
IDirectDrawSurface_Release
(
stencil1
);
if
(
surface1
!=
NULL
)
IDirectDrawSurface_Release
(
surface1
);
hr
=
IDirectDrawSurface7_DeleteAttachedSurface
(
surface
,
0
,
stencil
);
ok
(
hr
==
DD_OK
,
"DeleteAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
(
(
IUnknown
*
)
stencil
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
}
/* Releasing a surface should detach any attached surfaces */
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface
,
stencil
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
(
(
IUnknown
*
)
stencil
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
ref
=
IDirectDrawSurface7_Release
(
surface
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
ref
=
getRefcount
(
(
IUnknown
*
)
stencil
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
ref
=
IDirectDrawSurface7_Release
(
stencil
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
}
else
IDirectDrawSurface7_Release
(
surface
);
}
/* AddAttachedSurface with IDirectDrawSurface */
ddsd
.
dwSize
=
sizeof
(
DDSURFACEDESC
);
hr
=
IDirectDraw_CreateSurface
(
DDraw1
,
(
DDSURFACEDESC
*
)
&
ddsd
,
&
surface1
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ddsd_stencil
.
dwSize
=
sizeof
(
DDSURFACEDESC
);
hr
=
IDirectDraw_CreateSurface
(
DDraw1
,
(
DDSURFACEDESC
*
)
&
ddsd_stencil
,
&
stencil1
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* AddAttachedSurface with DeleteAttachedSurface */
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface1
,
stencil1
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ref
=
getRefcount
(
(
IUnknown
*
)
stencil1
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface1
,
0
,
stencil1
);
ok
(
hr
==
DD_OK
,
"DeleteAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
(
(
IUnknown
*
)
stencil1
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
}
/* Releasing a surface should detach any attached surfaces */
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface1
,
stencil1
);
ok
(
hr
==
DD_OK
,
"AddAttachedSurface returned %08x
\n
"
,
hr
);
ref
=
getRefcount
(
(
IUnknown
*
)
stencil1
);
ok
(
ref
==
2
,
"Got refcount %d, expected 2
\n
"
,
ref
);
ref
=
IDirectDrawSurface_Release
(
surface1
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
ref
=
getRefcount
(
(
IUnknown
*
)
stencil1
);
ok
(
ref
==
1
,
"Got refcount %d, expected 1
\n
"
,
ref
);
ref
=
IDirectDrawSurface_Release
(
stencil1
);
ok
(
!
ref
,
"Got refcount %d, expected 0
\n
"
,
ref
);
}
else
IDirectDrawSurface_Release
(
surface1
);
}
IDirectDraw7_Release
(
DDraw7
);
IDirectDraw7_Release
(
DDraw7
);
IDirectDraw4_Release
(
DDraw4
);
IDirectDraw4_Release
(
DDraw4
);
IDirectDraw2_Release
(
DDraw2
);
IDirectDraw2_Release
(
DDraw2
);
...
...
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