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
aa8cedb0
Commit
aa8cedb0
authored
Feb 01, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Update the primary surface format when changing the display mode.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
312cb811
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
0 deletions
+128
-0
ddraw.c
dlls/ddraw/ddraw.c
+12
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+29
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+29
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+29
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+29
-0
No files found.
dlls/ddraw/ddraw.c
View file @
aa8cedb0
...
...
@@ -1129,7 +1129,19 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
/* TODO: The possible return values from msdn suggest that the screen mode
* can't be changed if a surface is locked or some drawing is in progress. */
if
(
SUCCEEDED
(
hr
=
wined3d_set_adapter_display_mode
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
&
mode
)))
{
if
(
ddraw
->
primary
)
{
DDSURFACEDESC2
*
surface_desc
=
&
ddraw
->
primary
->
surface_desc
;
if
(
FAILED
(
hr
=
wined3d_swapchain_resize_buffers
(
ddraw
->
wined3d_swapchain
,
0
,
surface_desc
->
dwWidth
,
surface_desc
->
dwHeight
,
mode
.
format_id
,
WINED3D_MULTISAMPLE_NONE
,
0
)))
ERR
(
"Failed to resize buffers, hr %#x.
\n
"
,
hr
);
else
ddrawformat_from_wined3dformat
(
&
ddraw
->
primary
->
surface_desc
.
u4
.
ddpfPixelFormat
,
mode
.
format_id
);
}
ddraw
->
flags
|=
DDRAW_RESTORE_MODE
;
}
InterlockedCompareExchange
(
&
ddraw
->
device_state
,
DDRAW_DEVICE_STATE_NOT_RESTORED
,
DDRAW_DEVICE_STATE_OK
);
...
...
dlls/ddraw/tests/ddraw1.c
View file @
aa8cedb0
...
...
@@ -4629,9 +4629,28 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
8
,
"Got unexpected bit count %u.
\n
"
,
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
...
...
@@ -4639,6 +4658,16 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
);
done:
refcount
=
IDirectDrawSurface_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
dlls/ddraw/tests/ddraw2.c
View file @
aa8cedb0
...
...
@@ -5676,9 +5676,28 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
8
,
"Got unexpected bit count %u.
\n
"
,
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
...
...
@@ -5686,6 +5705,16 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
);
done:
refcount
=
IDirectDrawSurface_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
dlls/ddraw/tests/ddraw4.c
View file @
aa8cedb0
...
...
@@ -6947,9 +6947,28 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface4_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
8
,
"Got unexpected bit count %u.
\n
"
,
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface4_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_Restore
(
primary
);
...
...
@@ -6957,6 +6976,16 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface4_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
);
done:
refcount
=
IDirectDrawSurface4_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
dlls/ddraw/tests/ddraw7.c
View file @
aa8cedb0
...
...
@@ -6870,9 +6870,28 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface7_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
8
,
"Got unexpected bit count %u.
\n
"
,
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface7_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
);
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_Restore
(
primary
);
...
...
@@ -6880,6 +6899,16 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface7_GetSurfaceDesc
(
primary
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
surface_desc
.
dwWidth
==
640
,
"Got unexpected surface width %u.
\n
"
,
surface_desc
.
dwWidth
);
ok
(
surface_desc
.
dwHeight
==
480
,
"Got unexpected surface height %u.
\n
"
,
surface_desc
.
dwHeight
);
ok
(
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
32
||
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
==
24
,
"Got unexpected bit count %u.
\n
"
,
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
);
done:
refcount
=
IDirectDrawSurface7_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
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