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
e744bf78
Commit
e744bf78
authored
Apr 19, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add a helper function to set the viewport background material.
parent
5d358a2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
54 deletions
+33
-54
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+16
-24
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+17
-30
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
e744bf78
...
...
@@ -329,6 +329,18 @@ static IDirect3DViewport *create_viewport(IDirect3DDevice *device, UINT x, UINT
return
viewport
;
}
static
void
viewport_set_background
(
IDirect3DDevice
*
device
,
IDirect3DViewport
*
viewport
,
IDirect3DMaterial
*
material
)
{
D3DMATERIALHANDLE
material_handle
;
HRESULT
hr
;
hr
=
IDirect3DMaterial2_GetHandle
(
material
,
device
,
&
material_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_SetBackground
(
viewport
,
material_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
}
static
void
destroy_viewport
(
IDirect3DDevice
*
device
,
IDirect3DViewport
*
viewport
)
{
HRESULT
hr
;
...
...
@@ -681,7 +693,6 @@ static void test_clipper_blt(void)
static
void
test_coop_level_d3d_state
(
void
)
{
D3DRECT
clear_rect
=
{{
0
},
{
0
},
{
640
},
{
480
}};
D3DMATERIALHANDLE
background_handle
;
IDirectDrawSurface
*
rt
,
*
surface
;
IDirect3DMaterial
*
background
;
IDirect3DViewport
*
viewport
;
...
...
@@ -710,11 +721,7 @@ static void test_coop_level_d3d_state(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
hr
=
IDirect3DMaterial_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
viewport_set_background
(
device
,
viewport
,
background
);
hr
=
IDirect3DDevice_QueryInterface
(
device
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
rt
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
...
...
@@ -771,7 +778,6 @@ static void test_surface_interface_mismatch(void)
HRESULT
hr
;
D3DCOLOR
color
;
HWND
window
;
D3DMATERIALHANDLE
background_handle
;
D3DRECT
clear_rect
=
{{
0
},
{
0
},
{
640
},
{
480
}};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
...
...
@@ -845,11 +851,7 @@ static void test_surface_interface_mismatch(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
hr
=
IDirect3DMaterial_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
viewport_set_background
(
device
,
viewport
,
background
);
hr
=
IDirect3DViewport_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
...
...
@@ -992,7 +994,6 @@ static void test_zenable(void)
{{
640
.
0
f
},
{
0
.
0
f
},
{
1
.
5
f
},
{
1
.
0
f
},
{
0xff00ff00
},
{
0x00000000
},
{
0
.
0
f
},
{
0
.
0
f
}},
};
IDirect3DExecuteBuffer
*
execute_buffer
;
D3DMATERIALHANDLE
background_handle
;
D3DEXECUTEBUFFERDESC
exec_desc
;
IDirect3DMaterial
*
background
;
IDirect3DViewport
*
viewport
;
...
...
@@ -1026,11 +1027,7 @@ static void test_zenable(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
hr
=
IDirect3DMaterial_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
viewport_set_background
(
device
,
viewport
,
background
);
memset
(
&
exec_desc
,
0
,
sizeof
(
exec_desc
));
exec_desc
.
dwSize
=
sizeof
(
exec_desc
);
...
...
@@ -1128,7 +1125,6 @@ static void test_ck_rgba(void)
};
IDirect3DExecuteBuffer
*
execute_buffer
;
D3DMATERIALHANDLE
background_handle
;
D3DTEXTUREHANDLE
texture_handle
;
D3DEXECUTEBUFFERDESC
exec_desc
;
IDirect3DMaterial
*
background
;
...
...
@@ -1162,11 +1158,7 @@ static void test_ck_rgba(void)
background
=
create_diffuse_material
(
device
,
1
.
0
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
hr
=
IDirect3DMaterial_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
viewport_set_background
(
device
,
viewport
,
background
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
...
...
dlls/ddraw/tests/ddraw2.c
View file @
e744bf78
...
...
@@ -285,6 +285,18 @@ static IDirect3DViewport2 *create_viewport(IDirect3DDevice2 *device, UINT x, UIN
return
viewport
;
}
static
void
viewport_set_background
(
IDirect3DDevice2
*
device
,
IDirect3DViewport2
*
viewport
,
IDirect3DMaterial2
*
material
)
{
D3DMATERIALHANDLE
material_handle
;
HRESULT
hr
;
hr
=
IDirect3DMaterial2_GetHandle
(
material
,
device
,
&
material_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_SetBackground
(
viewport
,
material_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
}
static
void
destroy_viewport
(
IDirect3DDevice2
*
device
,
IDirect3DViewport2
*
viewport
)
{
HRESULT
hr
;
...
...
@@ -637,7 +649,6 @@ static void test_clipper_blt(void)
static
void
test_coop_level_d3d_state
(
void
)
{
D3DRECT
clear_rect
=
{{
0
},
{
0
},
{
640
},
{
480
}};
D3DMATERIALHANDLE
background_handle
;
IDirectDrawSurface
*
rt
,
*
surface
;
IDirect3DMaterial2
*
background
;
IDirect3DViewport2
*
viewport
;
...
...
@@ -667,11 +678,7 @@ static void test_coop_level_d3d_state(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
hr
=
IDirect3DMaterial2_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
viewport_set_background
(
device
,
viewport
,
background
);
hr
=
IDirect3DDevice2_GetRenderTarget
(
device
,
&
rt
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
...
...
@@ -742,7 +749,6 @@ static void test_surface_interface_mismatch(void)
HRESULT
hr
;
D3DCOLOR
color
;
HWND
window
;
D3DMATERIALHANDLE
background_handle
;
D3DRECT
clear_rect
=
{{
0
},
{
0
},
{
640
},
{
480
}};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
...
...
@@ -816,11 +822,7 @@ static void test_surface_interface_mismatch(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
hr
=
IDirect3DMaterial2_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
viewport_set_background
(
device
,
viewport
,
background
);
hr
=
IDirect3DViewport2_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
...
...
@@ -897,7 +899,6 @@ static void test_depth_blit(void)
HWND
window
;
D3DRECT
d3drect
;
IDirect3DMaterial2
*
background
;
D3DMATERIALHANDLE
background_handle
;
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
...
...
@@ -934,14 +935,10 @@ static void test_depth_blit(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
ddsd_existing
.
dwWidth
,
ddsd_existing
.
dwHeight
);
viewport_set_background
(
device
,
viewport
,
background
);
hr
=
IDirect3DDevice2_SetCurrentViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to activate the viewport, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DMaterial2_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
D3DZB_TRUE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to enable z testing, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_ZFUNC
,
D3DCMP_LESSEQUAL
);
...
...
@@ -1249,7 +1246,6 @@ static void test_zenable(void)
{{
640
.
0
f
},
{
480
.
0
f
},
{
1
.
5
f
},
{
1
.
0
f
},
{
0xff00ff00
},
{
0x00000000
},
{
0
.
0
f
},
{
0
.
0
f
}},
{{
640
.
0
f
},
{
0
.
0
f
},
{
1
.
5
f
},
{
1
.
0
f
},
{
0xff00ff00
},
{
0x00000000
},
{
0
.
0
f
},
{
0
.
0
f
}},
};
D3DMATERIALHANDLE
background_handle
;
IDirect3DMaterial2
*
background
;
IDirect3DViewport2
*
viewport
;
IDirect3DDevice2
*
device
;
...
...
@@ -1279,14 +1275,10 @@ static void test_zenable(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
viewport_set_background
(
device
,
viewport
,
background
);
hr
=
IDirect3DDevice2_SetCurrentViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set current viewport, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DMaterial2_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
D3DZB_FALSE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to disable z-buffering, hr %#x.
\n
"
,
hr
);
...
...
@@ -1355,7 +1347,6 @@ static void test_ck_rgba(void)
{
0x7f00ff00
,
FALSE
,
FALSE
,
0x0000ff00
,
0x0000ff00
},
};
D3DMATERIALHANDLE
background_handle
;
D3DTEXTUREHANDLE
texture_handle
;
IDirect3DMaterial2
*
background
;
IDirectDrawSurface
*
surface
;
...
...
@@ -1388,14 +1379,10 @@ static void test_ck_rgba(void)
background
=
create_diffuse_material
(
device
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
viewport_set_background
(
device
,
viewport
,
background
);
hr
=
IDirect3DDevice2_SetCurrentViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set current viewport, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DMaterial2_GetHandle
(
background
,
device
,
&
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get material handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_SetBackground
(
viewport
,
background_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set viewport background, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
|
DDSD_CKSRCBLT
;
...
...
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