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
5e4145d0
Commit
5e4145d0
authored
May 10, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
May 11, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Skip redundant mode setting calls.
parent
87b45c35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
9 deletions
+27
-9
ddraw.c
dlls/ddraw/ddraw.c
+26
-8
d3d.c
dlls/ddraw/tests/d3d.c
+1
-1
No files found.
dlls/ddraw/ddraw.c
View file @
5e4145d0
...
...
@@ -830,6 +830,7 @@ static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window
static
HRESULT
ddraw_set_display_mode
(
IDirectDrawImpl
*
ddraw
,
DWORD
Width
,
DWORD
Height
,
DWORD
BPP
,
DWORD
RefreshRate
,
DWORD
Flags
)
{
enum
wined3d_format_id
format
;
WINED3DDISPLAYMODE
Mode
;
HRESULT
hr
;
...
...
@@ -845,6 +846,30 @@ static HRESULT ddraw_set_display_mode(IDirectDrawImpl *ddraw, DWORD Width, DWORD
return
DD_OK
;
}
switch
(
BPP
)
{
case
8
:
format
=
WINED3DFMT_P8_UINT
;
break
;
case
15
:
format
=
WINED3DFMT_B5G5R5X1_UNORM
;
break
;
case
16
:
format
=
WINED3DFMT_B5G6R5_UNORM
;
break
;
case
24
:
format
=
WINED3DFMT_B8G8R8_UNORM
;
break
;
case
32
:
format
=
WINED3DFMT_B8G8R8X8_UNORM
;
break
;
default:
format
=
WINED3DFMT_UNKNOWN
;
break
;
}
if
(
FAILED
(
hr
=
IWineD3DDevice_GetDisplayMode
(
ddraw
->
wineD3DDevice
,
0
,
&
Mode
)))
{
ERR
(
"Failed to get current display mode, hr %#x.
\n
"
,
hr
);
}
else
if
(
Mode
.
Width
==
Width
&&
Mode
.
Height
==
Height
&&
Mode
.
Format
==
format
&&
Mode
.
RefreshRate
==
RefreshRate
)
{
TRACE
(
"Skipping redundant mode setting call.
\n
"
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
DD_OK
;
}
/* Check the exclusive mode
if(!(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
return DDERR_NOEXCLUSIVEMODE;
...
...
@@ -857,14 +882,7 @@ static HRESULT ddraw_set_display_mode(IDirectDrawImpl *ddraw, DWORD Width, DWORD
Mode
.
Width
=
Width
;
Mode
.
Height
=
Height
;
Mode
.
RefreshRate
=
RefreshRate
;
switch
(
BPP
)
{
case
8
:
Mode
.
Format
=
WINED3DFMT_P8_UINT
;
break
;
case
15
:
Mode
.
Format
=
WINED3DFMT_B5G5R5X1_UNORM
;
break
;
case
16
:
Mode
.
Format
=
WINED3DFMT_B5G6R5_UNORM
;
break
;
case
24
:
Mode
.
Format
=
WINED3DFMT_B8G8R8_UNORM
;
break
;
case
32
:
Mode
.
Format
=
WINED3DFMT_B8G8R8X8_UNORM
;
break
;
}
Mode
.
Format
=
format
;
/* TODO: The possible return values from msdn suggest that
* the screen mode can't be changed if a surface is locked
...
...
dlls/ddraw/tests/d3d.c
View file @
5e4145d0
...
...
@@ -3974,7 +3974,7 @@ static void test_redundant_mode_set(void)
ok
(
SUCCEEDED
(
hr
),
"SetDipslayMode failed, hr %#x.
\n
"
,
hr
);
GetWindowRect
(
window
,
&
s
);
todo_wine
ok
(
EqualRect
(
&
r
,
&
s
),
"Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.
\n
"
,
ok
(
EqualRect
(
&
r
,
&
s
),
"Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.
\n
"
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
s
.
left
,
s
.
top
,
s
.
right
,
s
.
bottom
);
...
...
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