[MPlayer-cvslog] r32619 - trunk/libvo/w32_common.c
reimar
subversion at mplayerhq.hu
Wed Nov 10 23:10:30 CET 2010
Author: reimar
Date: Wed Nov 10 23:10:30 2010
New Revision: 32619
Log:
Move setting of pixel format from init to config.
This allows it to depend on flags etc.
Modified:
trunk/libvo/w32_common.c
Modified: trunk/libvo/w32_common.c
==============================================================================
--- trunk/libvo/w32_common.c Wed Nov 10 18:49:11 2010 (r32618)
+++ trunk/libvo/w32_common.c Wed Nov 10 23:10:30 2010 (r32619)
@@ -389,6 +389,27 @@ static int createRenderingContext(void)
* \return 1 - Success, 0 - Failure
*/
int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) {
+ PIXELFORMATDESCRIPTOR pfd;
+ int pf;
+ HDC vo_hdc = vo_w32_get_dc(vo_window);
+
+ memset(&pfd, 0, sizeof pfd);
+ pfd.nSize = sizeof pfd;
+ pfd.nVersion = 1;
+ pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
+ pfd.iPixelType = PFD_TYPE_RGBA;
+ pfd.cColorBits = 24;
+ pfd.iLayerType = PFD_MAIN_PLANE;
+ pf = ChoosePixelFormat(vo_hdc, &pfd);
+ if (!pf) {
+ mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n");
+ vo_w32_release_dc(vo_window, vo_hdc);
+ return 0;
+ }
+
+ SetPixelFormat(vo_hdc, pf, &pfd);
+ vo_w32_release_dc(vo_window, vo_hdc);
+
// we already have a fully initialized window, so nothing needs to be done
if (flags & VOFLAG_HIDDEN)
return 1;
@@ -440,9 +461,6 @@ static char *get_display_name(void) {
* \return 1 = Success, 0 = Failure
*/
int vo_w32_init(void) {
- PIXELFORMATDESCRIPTOR pfd;
- HDC vo_hdc;
- int pf;
HICON mplayerIcon = 0;
char exedir[MAX_PATH];
HINSTANCE user32;
@@ -500,24 +518,6 @@ int vo_w32_init(void) {
free(dev);
updateScreenProperties();
- vo_hdc = vo_w32_get_dc(vo_window);
- memset(&pfd, 0, sizeof pfd);
- pfd.nSize = sizeof pfd;
- pfd.nVersion = 1;
- pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
- pfd.iPixelType = PFD_TYPE_RGBA;
- pfd.cColorBits = 24;
- pfd.iLayerType = PFD_MAIN_PLANE;
- pf = ChoosePixelFormat(vo_hdc, &pfd);
- if (!pf) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n");
- vo_w32_release_dc(vo_window, vo_hdc);
- return 0;
- }
-
- SetPixelFormat(vo_hdc, pf, &pfd);
- vo_w32_release_dc(vo_window, vo_hdc);
-
mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen);
return 1;
More information about the MPlayer-cvslog
mailing list