From 90784dfc9d139d520a4b1c2f85778b0c1e4af95b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 10 Nov 2012 16:20:03 +0100 Subject: [PATCH] win32: remove pointless get/release DC wrappers --- video/out/gl_common.c | 10 +++++----- video/out/w32_common.c | 28 +++------------------------- video/out/w32_common.h | 2 -- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 1781233bf7..8f4ef3525a 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -2063,7 +2063,7 @@ static bool create_window_w32_old(struct MPGLContext *ctx, uint32_t d_width, } HWND win = ctx->vo->w32->window; - HDC windc = vo_w32_get_dc(ctx->vo, win); + HDC windc = GetDC(win); bool res = false; HGLRC new_context = wglCreateContext(windc); @@ -2084,7 +2084,7 @@ static bool create_window_w32_old(struct MPGLContext *ctx, uint32_t d_width, res = true; out: - vo_w32_release_dc(ctx->vo, win, windc); + ReleaseDC(win, windc); return res; } @@ -2101,7 +2101,7 @@ static bool create_window_w32_gl3(struct MPGLContext *ctx, uint32_t d_width, return true; // not reusing it breaks gl3! HWND win = ctx->vo->w32->window; - HDC windc = vo_w32_get_dc(ctx->vo, win); + HDC windc = GetDC(win); HGLRC new_context = 0; new_context = wglCreateContext(windc); @@ -2200,9 +2200,9 @@ static void releaseGlContext_w32(MPGLContext *ctx) static void swapGlBuffers_w32(MPGLContext *ctx) { - HDC vo_hdc = vo_w32_get_dc(ctx->vo, ctx->vo->w32->window); + HDC vo_hdc = GetDC(ctx->vo->w32->window); SwapBuffers(vo_hdc); - vo_w32_release_dc(ctx->vo, ctx->vo->w32->window, vo_hdc); + ReleaseDC(ctx->vo->w32->window, vo_hdc); } #endif diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 3edfa97595..ab608f5d8d 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -534,7 +534,7 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height, struct vo_w32_state *w32 = vo->w32; PIXELFORMATDESCRIPTOR pfd; int pf; - HDC vo_hdc = vo_w32_get_dc(vo, w32->window); + HDC vo_hdc = GetDC(w32->window); memset(&pfd, 0, sizeof pfd); pfd.nSize = sizeof pfd; @@ -548,12 +548,12 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height, 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, w32->window, vo_hdc); + ReleaseDC(w32->window, vo_hdc); return 0; } SetPixelFormat(vo_hdc, pf, &pfd); - vo_w32_release_dc(vo, w32->window, vo_hdc); + ReleaseDC(w32->window, vo_hdc); // we already have a fully initialized window, so nothing needs to be done if (flags & VOFLAG_HIDDEN) @@ -733,25 +733,3 @@ void vo_w32_uninit(struct vo *vo) talloc_free(w32); vo->w32 = NULL; } - -/** - * \brief get a device context to draw in - * - * \param wnd window the DC should belong to if it makes sense - */ -HDC vo_w32_get_dc(struct vo *vo, HWND wnd) -{ - struct vo_w32_state *w32 = vo->w32; - return GetDC(wnd); -} - -/** - * \brief release a device context - * - * \param wnd window the DC probably belongs to - */ -void vo_w32_release_dc(struct vo *vo, HWND wnd, HDC dc) -{ - struct vo_w32_state *w32 = vo->w32; - ReleaseDC(wnd, dc); -} diff --git a/video/out/w32_common.h b/video/out/w32_common.h index c6d9fc7653..cd74ae17ac 100644 --- a/video/out/w32_common.h +++ b/video/out/w32_common.h @@ -60,7 +60,5 @@ void vo_w32_fullscreen(struct vo *vo); int vo_w32_check_events(struct vo *vo); int vo_w32_config(struct vo *vo, uint32_t, uint32_t, uint32_t); void w32_update_xinerama_info(struct vo *vo); -HDC vo_w32_get_dc(struct vo *vo, HWND wnd); -void vo_w32_release_dc(struct vo *vo, HWND wnd, HDC dc); #endif /* MPLAYER_W32_COMMON_H */