summaryrefslogtreecommitdiffstats
path: root/libvo/w32_common.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-09 19:58:02 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-09 19:58:02 +0200
commit173beb5608d893c0d9b42c1043f1dfa2db2e4df2 (patch)
tree9d91be39eb1a2edb2eec45d537630f518e04378a /libvo/w32_common.c
parented0237e7d3c491282fbdc29c5ac294425055de57 (diff)
parentc5b0ff1cfacfa502eb0647f329756ddf7c79fcb6 (diff)
downloadmpv-173beb5608d893c0d9b42c1043f1dfa2db2e4df2.tar.bz2
mpv-173beb5608d893c0d9b42c1043f1dfa2db2e4df2.tar.xz
Merge svn changes up to r30514
Diffstat (limited to 'libvo/w32_common.c')
-rw-r--r--libvo/w32_common.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index 3b5f97de29..47c1d6198e 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -332,10 +332,7 @@ static void resetMode(void) {
static int createRenderingContext(void) {
HWND layer = HWND_NOTOPMOST;
- PIXELFORMATDESCRIPTOR pfd;
- HDC vo_hdc = vo_w32_get_dc(vo_window);
RECT r;
- int pf;
if (WinID < 0) {
int style = (vo_border && !vo_fs) ?
(WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP;
@@ -381,26 +378,6 @@ static int createRenderingContext(void) {
AdjustWindowRect(&r, style, 0);
SetWindowPos(vo_window, layer, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW);
}
-
- 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");
- ReleaseDC(vo_window, vo_hdc);
- return 0;
- }
-
- SetPixelFormat(vo_hdc, pf, &pfd);
-
- mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, depthonscreen);
-
- vo_w32_release_dc(vo_window, vo_hdc);
return 1;
}
@@ -417,6 +394,9 @@ static int createRenderingContext(void) {
* \return 1 - Success, 0 - Failure
*/
int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) {
+ // we already have a fully initialized window, so nothing needs to be done
+ if (flags & VOFLAG_HIDDEN)
+ return;
// store original size for videomode switching
o_dwidth = width;
o_dheight = height;
@@ -457,13 +437,15 @@ static char *get_display_name(void) {
*
* Global libvo variables changed:
* vo_w32_window
- * vo_depthonscreen
* vo_screenwidth
* vo_screenheight
*
* \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;
@@ -520,6 +502,26 @@ int vo_w32_init(void) {
if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL);
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, depthonscreen);
+
return 1;
}