1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 21:27:08 +00:00

win32: remove pointless get/release DC wrappers

This commit is contained in:
wm4 2012-11-10 16:20:03 +01:00
parent 5afacef0e4
commit 90784dfc9d
3 changed files with 8 additions and 32 deletions

View File

@ -2063,7 +2063,7 @@ static bool create_window_w32_old(struct MPGLContext *ctx, uint32_t d_width,
} }
HWND win = ctx->vo->w32->window; HWND win = ctx->vo->w32->window;
HDC windc = vo_w32_get_dc(ctx->vo, win); HDC windc = GetDC(win);
bool res = false; bool res = false;
HGLRC new_context = wglCreateContext(windc); HGLRC new_context = wglCreateContext(windc);
@ -2084,7 +2084,7 @@ static bool create_window_w32_old(struct MPGLContext *ctx, uint32_t d_width,
res = true; res = true;
out: out:
vo_w32_release_dc(ctx->vo, win, windc); ReleaseDC(win, windc);
return res; 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! return true; // not reusing it breaks gl3!
HWND win = ctx->vo->w32->window; HWND win = ctx->vo->w32->window;
HDC windc = vo_w32_get_dc(ctx->vo, win); HDC windc = GetDC(win);
HGLRC new_context = 0; HGLRC new_context = 0;
new_context = wglCreateContext(windc); new_context = wglCreateContext(windc);
@ -2200,9 +2200,9 @@ static void releaseGlContext_w32(MPGLContext *ctx)
static void swapGlBuffers_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); SwapBuffers(vo_hdc);
vo_w32_release_dc(ctx->vo, ctx->vo->w32->window, vo_hdc); ReleaseDC(ctx->vo->w32->window, vo_hdc);
} }
#endif #endif

View File

@ -534,7 +534,7 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height,
struct vo_w32_state *w32 = vo->w32; struct vo_w32_state *w32 = vo->w32;
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;
int pf; int pf;
HDC vo_hdc = vo_w32_get_dc(vo, w32->window); HDC vo_hdc = GetDC(w32->window);
memset(&pfd, 0, sizeof pfd); memset(&pfd, 0, sizeof pfd);
pfd.nSize = 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); pf = ChoosePixelFormat(vo_hdc, &pfd);
if (!pf) { if (!pf) {
mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n"); 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; return 0;
} }
SetPixelFormat(vo_hdc, pf, &pfd); 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 // we already have a fully initialized window, so nothing needs to be done
if (flags & VOFLAG_HIDDEN) if (flags & VOFLAG_HIDDEN)
@ -733,25 +733,3 @@ void vo_w32_uninit(struct vo *vo)
talloc_free(w32); talloc_free(w32);
vo->w32 = NULL; 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);
}

View File

@ -60,7 +60,5 @@ void vo_w32_fullscreen(struct vo *vo);
int vo_w32_check_events(struct vo *vo); int vo_w32_check_events(struct vo *vo);
int vo_w32_config(struct vo *vo, uint32_t, uint32_t, uint32_t); int vo_w32_config(struct vo *vo, uint32_t, uint32_t, uint32_t);
void w32_update_xinerama_info(struct vo *vo); 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 */ #endif /* MPLAYER_W32_COMMON_H */