Mercurial > mplayer.hg
changeset 32532:d3e318fd8899
Move setting of pixel format from init to config.
This allows it to depend on flags etc.
author | reimar |
---|---|
date | Wed, 10 Nov 2010 22:10:30 +0000 |
parents | 48ee2c151251 |
children | c41773445d3b |
files | libvo/w32_common.c |
diffstat | 1 files changed, 21 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/w32_common.c Wed Nov 10 17:49:11 2010 +0000 +++ b/libvo/w32_common.c Wed Nov 10 22:10:30 2010 +0000 @@ -389,6 +389,27 @@ * \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 @@ * \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 @@ 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;