summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-26 20:28:01 +0200
committerwm4 <wm4@nowhere>2014-07-26 20:28:01 +0200
commit9a3f1f24ca86b299c9d5f8c42eccab7fca26b2dd (patch)
treef4b91036737d9c6ae3aa89a98258fc62b1a31300 /video/out/w32_common.c
parent7f0d9a95fa943f516fcb176ccc40c8bc54af890e (diff)
downloadmpv-9a3f1f24ca86b299c9d5f8c42eccab7fca26b2dd.tar.bz2
mpv-9a3f1f24ca86b299c9d5f8c42eccab7fca26b2dd.tar.xz
win32: don't use CS_OWNDC
CS_OWNDC will make GetDC() always return the same HDC. This might become a problem when OpenGL rendering and window management are on different threads. Although I'm not too sure about this; our code never requests a HDC outside of the OpenGL backend, and it depends on whether win32 will internally request DCs. But in any case, this seems to be cleaner. Move the GL pixelformat setup code to gl_w32.c, where it's actually needed. This also fixes that SetPixelFormat() should be called only once, and not every time video params change.
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 9e72b5e010..486969e223 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -877,31 +877,6 @@ static int reinit_window_state(struct vo_w32_state *w32)
int vo_w32_config(struct vo *vo, uint32_t flags)
{
struct vo_w32_state *w32 = vo->w32;
- PIXELFORMATDESCRIPTOR pfd;
- int pf;
- HDC vo_hdc = GetDC(w32->window);
-
- memset(&pfd, 0, sizeof pfd);
- pfd.nSize = sizeof pfd;
- pfd.nVersion = 1;
- pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
-
- if (flags & VOFLAG_STEREO)
- pfd.dwFlags |= PFD_STEREO;
-
- pfd.iPixelType = PFD_TYPE_RGBA;
- pfd.cColorBits = 24;
- pfd.iLayerType = PFD_MAIN_PLANE;
- pf = ChoosePixelFormat(vo_hdc, &pfd);
-
- if (!pf) {
- MP_ERR(w32, "unable to select a valid pixel format!\n");
- ReleaseDC(w32->window, vo_hdc);
- return 0;
- }
-
- SetPixelFormat(vo_hdc, pf, &pfd);
- ReleaseDC(w32->window, vo_hdc);
// we already have a fully initialized window, so nothing needs to be done
if (flags & VOFLAG_HIDDEN)
@@ -966,7 +941,7 @@ int vo_w32_init(struct vo *vo)
WNDCLASSEXW wcex = {
.cbSize = sizeof wcex,
- .style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW,
+ .style = CS_HREDRAW | CS_VREDRAW,
.lpfnWndProc = WndProc,
.hInstance = hInstance,
.hIcon = LoadIconW(hInstance, L"IDI_ICON1"),