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
351fae12
Commit
351fae12
authored
May 06, 2014
by
Ken Thomases
Committed by
Alexandre Julliard
May 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Consolidate duplicate code from glxdrv_wglSetPixelFormat() and…
winex11: Consolidate duplicate code from glxdrv_wglSetPixelFormat() and X11DRV_wglSetPixelFormatWINE().
parent
f0a91c02
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
79 deletions
+62
-79
opengl.c
dlls/winex11.drv/opengl.c
+62
-79
No files found.
dlls/winex11.drv/opengl.c
View file @
351fae12
...
...
@@ -1407,6 +1407,66 @@ static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format )
return
TRUE
;
}
static
BOOL
set_pixel_format
(
HDC
hdc
,
int
format
,
BOOL
allow_change
)
{
const
struct
wgl_pixel_format
*
fmt
;
int
value
;
HWND
hwnd
=
WindowFromDC
(
hdc
);
TRACE
(
"(%p,%d)
\n
"
,
hdc
,
format
);
if
(
!
hwnd
||
hwnd
==
GetDesktopWindow
())
{
WARN
(
"not a valid window DC %p/%p
\n
"
,
hdc
,
hwnd
);
return
FALSE
;
}
fmt
=
get_pixel_format
(
gdi_display
,
format
,
FALSE
/* Offscreen */
);
if
(
!
fmt
)
{
ERR
(
"Invalid format %d
\n
"
,
format
);
return
FALSE
;
}
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DRAWABLE_TYPE
,
&
value
);
if
(
!
(
value
&
GLX_WINDOW_BIT
))
{
WARN
(
"Pixel format %d is not compatible for window rendering
\n
"
,
format
);
return
FALSE
;
}
if
(
!
allow_change
)
{
struct
gl_drawable
*
gl
;
if
((
gl
=
get_gl_drawable
(
hwnd
,
hdc
)))
{
int
prev
=
pixel_format_index
(
gl
->
format
);
release_gl_drawable
(
gl
);
return
prev
==
format
;
/* cannot change it if already set */
}
}
if
(
TRACE_ON
(
wgl
))
{
int
gl_test
=
0
;
gl_test
=
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_FBCONFIG_ID
,
&
value
);
if
(
gl_test
)
{
ERR
(
"Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.
\n
"
);
}
else
{
TRACE
(
" FBConfig have :
\n
"
);
TRACE
(
" - FBCONFIG_ID 0x%x
\n
"
,
value
);
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_VISUAL_ID
,
&
value
);
TRACE
(
" - VISUAL_ID 0x%x
\n
"
,
value
);
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DRAWABLE_TYPE
,
&
value
);
TRACE
(
" - DRAWABLE_TYPE 0x%x
\n
"
,
value
);
}
}
return
set_win_format
(
hwnd
,
fmt
);
}
/***********************************************************************
* sync_gl_drawable
*/
...
...
@@ -1686,57 +1746,7 @@ static int glxdrv_wglGetPixelFormat( HDC hdc )
*/
static
BOOL
glxdrv_wglSetPixelFormat
(
HDC
hdc
,
int
iPixelFormat
,
const
PIXELFORMATDESCRIPTOR
*
ppfd
)
{
const
struct
wgl_pixel_format
*
fmt
;
int
value
;
struct
gl_drawable
*
gl
;
HWND
hwnd
=
WindowFromDC
(
hdc
);
TRACE
(
"(%p,%d,%p)
\n
"
,
hdc
,
iPixelFormat
,
ppfd
);
if
(
!
hwnd
||
hwnd
==
GetDesktopWindow
())
{
WARN
(
"not a proper window DC %p/%p
\n
"
,
hdc
,
hwnd
);
return
FALSE
;
}
/* Check if iPixelFormat is in our list of supported formats to see if it is supported. */
fmt
=
get_pixel_format
(
gdi_display
,
iPixelFormat
,
FALSE
/* Offscreen */
);
if
(
!
fmt
)
{
ERR
(
"Invalid iPixelFormat: %d
\n
"
,
iPixelFormat
);
return
FALSE
;
}
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DRAWABLE_TYPE
,
&
value
);
if
(
!
(
value
&
GLX_WINDOW_BIT
))
{
WARN
(
"Pixel format %d is not compatible for window rendering
\n
"
,
iPixelFormat
);
return
FALSE
;
}
if
((
gl
=
get_gl_drawable
(
hwnd
,
hdc
)))
{
int
prev
=
pixel_format_index
(
gl
->
format
);
release_gl_drawable
(
gl
);
return
prev
==
iPixelFormat
;
/* cannot change it if already set */
}
if
(
TRACE_ON
(
wgl
))
{
int
gl_test
=
0
;
gl_test
=
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_FBCONFIG_ID
,
&
value
);
if
(
gl_test
)
{
ERR
(
"Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.
\n
"
);
}
else
{
TRACE
(
" FBConfig have :
\n
"
);
TRACE
(
" - FBCONFIG_ID 0x%x
\n
"
,
value
);
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_VISUAL_ID
,
&
value
);
TRACE
(
" - VISUAL_ID 0x%x
\n
"
,
value
);
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DRAWABLE_TYPE
,
&
value
);
TRACE
(
" - DRAWABLE_TYPE 0x%x
\n
"
,
value
);
}
}
return
set_win_format
(
hwnd
,
fmt
);
return
set_pixel_format
(
hdc
,
iPixelFormat
,
FALSE
);
}
/***********************************************************************
...
...
@@ -3019,34 +3029,7 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval)
*/
static
BOOL
X11DRV_wglSetPixelFormatWINE
(
HDC
hdc
,
int
format
)
{
const
struct
wgl_pixel_format
*
fmt
;
int
value
;
HWND
hwnd
;
TRACE
(
"(%p,%d)
\n
"
,
hdc
,
format
);
fmt
=
get_pixel_format
(
gdi_display
,
format
,
FALSE
/* Offscreen */
);
if
(
!
fmt
)
{
ERR
(
"Invalid format %d
\n
"
,
format
);
return
FALSE
;
}
hwnd
=
WindowFromDC
(
hdc
);
if
(
!
hwnd
||
hwnd
==
GetDesktopWindow
())
{
ERR
(
"not a valid window DC %p
\n
"
,
hdc
);
return
FALSE
;
}
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DRAWABLE_TYPE
,
&
value
);
if
(
!
(
value
&
GLX_WINDOW_BIT
))
{
WARN
(
"Pixel format %d is not compatible for window rendering
\n
"
,
format
);
return
FALSE
;
}
return
set_win_format
(
hwnd
,
fmt
);
return
set_pixel_format
(
hdc
,
format
,
TRUE
);
}
/**
...
...
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