Mercurial > mplayer.hg
diff libvo/gl_common.c @ 24314:20359547f3c3
Remove global vo_hdc, since it is recommended to release a DC as soon as possible.
author | reimar |
---|---|
date | Mon, 03 Sep 2007 08:44:36 +0000 |
parents | 7589c6f9880a |
children | 12f2487fb845 |
line wrap: on
line diff
--- a/libvo/gl_common.c Mon Sep 03 08:36:27 2007 +0000 +++ b/libvo/gl_common.c Mon Sep 03 08:44:36 2007 +0000 @@ -1341,6 +1341,7 @@ HDC windc = GetDC(win); HGLRC new_context = 0; int keep_context = 0; + int res = SET_WINDOW_FAILED; // should only be needed when keeping context, but not doing glFinish // can cause flickering even when we do not keep it. @@ -1356,7 +1357,7 @@ new_context = wglCreateContext(windc); if (!new_context) { mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GL context!\n"); - return SET_WINDOW_FAILED; + goto out; } } @@ -1366,12 +1367,11 @@ if (!keep_context) { wglDeleteContext(new_context); } - return SET_WINDOW_FAILED; + goto out; } // set new values vo_w32_window = win; - vo_hdc = windc; { RECT rect; GetClientRect(win, &rect); @@ -1386,9 +1386,13 @@ getFunctions(w32gpa, NULL); // and inform that reinit is neccessary - return SET_WINDOW_REINIT; - } - return SET_WINDOW_OK; + res = SET_WINDOW_REINIT; + } else + res = SET_WINDOW_OK; + +out: + ReleaseDC(windc); + return res; } void releaseGlContext(int *vinfo, HGLRC *context) { @@ -1401,7 +1405,9 @@ } void swapGlBuffers() { + HDC vo_hdc = GetDC(vo_w32_window); SwapBuffers(vo_hdc); + ReleaseDC(vo_hdc); } #else #ifdef HAVE_LIBDL