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
c2fd62d0
Commit
c2fd62d0
authored
Feb 12, 2001
by
Ove Kaaven
Committed by
Alexandre Julliard
Feb 12, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DGA2 mode setting to use the correct color depth.
parent
696ff195
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
11 deletions
+39
-11
dga2.c
dlls/ddraw/ddraw/dga2.c
+39
-11
No files found.
dlls/ddraw/ddraw/dga2.c
View file @
c2fd62d0
/* DirectDraw driver for XF86DGA2 primary surface
*
* Copyright 2000 TransGaming Technologies Inc.
* Copyright 2000
-2001
TransGaming Technologies Inc.
*/
#include "config.h"
...
...
@@ -100,16 +100,31 @@ static void cleanup(void)
TSXFree
(
modes
);
}
static
XDGAMode
*
choose_mode
(
DWORD
dwWidth
,
DWORD
dwHeight
,
static
XDGAMode
*
choose_mode
(
DWORD
dwWidth
,
DWORD
dwHeight
,
DWORD
dwBPP
,
DWORD
dwRefreshRate
,
DWORD
dwFlags
)
{
XDGAMode
*
best
=
NULL
;
int
i
;
int
depth
,
bpp
,
i
;
switch
(
dwBPP
)
{
case
8
:
depth
=
dwBPP
;
bpp
=
8
;
break
;
case
15
:
case
16
:
depth
=
dwBPP
;
bpp
=
16
;
break
;
case
24
:
case
32
:
depth
=
24
;
bpp
=
dwBPP
;
break
;
default:
ERR
(
"invalid color depth (%ld)
\n
"
,
dwBPP
);
return
NULL
;
}
/* Choose the smallest mode that is large enough. */
for
(
i
=
0
;
i
<
num_modes
;
i
++
)
{
if
(
modes
[
i
].
viewportWidth
>=
dwWidth
&&
modes
[
i
].
viewportHeight
>=
dwHeight
)
if
(
modes
[
i
].
viewportWidth
>=
dwWidth
&&
modes
[
i
].
viewportHeight
>=
dwHeight
&&
modes
[
i
].
depth
==
depth
&&
modes
[
i
].
bitsPerPixel
==
bpp
)
{
if
(
best
==
NULL
)
best
=
&
modes
[
i
];
else
...
...
@@ -121,23 +136,32 @@ static XDGAMode* choose_mode(DWORD dwWidth, DWORD dwHeight,
}
}
/* all modes were too small, use the largest */
if
(
!
best
)
{
TRACE
(
"all modes too small
\n
"
);
/* use the largest */
for
(
i
=
1
;
i
<
num_modes
;
i
++
)
{
if
(
best
==
NULL
)
best
=
&
modes
[
i
];
else
if
(
modes
[
i
].
depth
==
depth
&&
modes
[
i
].
bitsPerPixel
==
bpp
)
{
if
(
modes
[
i
].
viewportWidth
>
best
->
viewportWidth
||
modes
[
i
].
viewportHeight
>
best
->
viewportHeight
)
best
=
&
modes
[
i
];
if
(
best
==
NULL
)
best
=
&
modes
[
i
];
else
{
if
(
modes
[
i
].
viewportWidth
>
best
->
viewportWidth
||
modes
[
i
].
viewportHeight
>
best
->
viewportHeight
)
best
=
&
modes
[
i
];
}
}
}
}
if
(
!
best
)
{
ERR
(
"requested color depth (%ld) not available, try reconfiguring X server
\n
"
,
dwBPP
);
return
NULL
;
}
TRACE
(
"using %d %d for %lu %lu
\n
"
,
best
->
viewportWidth
,
best
->
viewportHeight
,
dwWidth
,
dwHeight
);
...
...
@@ -331,7 +355,11 @@ XF86DGA2_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
XDGAMode
*
new_mode
;
int
old_mode_num
=
old_mode
?
old_mode
->
mode
.
num
:
0
;
new_mode
=
choose_mode
(
dwWidth
,
dwHeight
,
dwRefreshRate
,
dwFlags
);
new_mode
=
choose_mode
(
dwWidth
,
dwHeight
,
dwBPP
,
dwRefreshRate
,
dwFlags
);
if
(
!
new_mode
)
{
return
DDERR_INVALIDMODE
;
}
if
(
new_mode
&&
new_mode
->
num
!=
old_mode_num
)
{
...
...
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