mirror of
https://github.com/mpv-player/mpv
synced 2025-04-17 20:58:20 +00:00
Set the PixelFormat right after creating the window and set it only once.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30508 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
f34454b6b5
commit
bf6dc310dc
@ -329,10 +329,7 @@ static void resetMode(void) {
|
|||||||
|
|
||||||
static int createRenderingContext(void) {
|
static int createRenderingContext(void) {
|
||||||
HWND layer = HWND_NOTOPMOST;
|
HWND layer = HWND_NOTOPMOST;
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
|
||||||
HDC vo_hdc = vo_w32_get_dc(vo_window);
|
|
||||||
RECT r;
|
RECT r;
|
||||||
int pf;
|
|
||||||
if (WinID < 0) {
|
if (WinID < 0) {
|
||||||
int style = (vo_border && !vo_fs) ?
|
int style = (vo_border && !vo_fs) ?
|
||||||
(WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP;
|
(WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP;
|
||||||
@ -378,26 +375,6 @@ static int createRenderingContext(void) {
|
|||||||
AdjustWindowRect(&r, style, 0);
|
AdjustWindowRect(&r, style, 0);
|
||||||
SetWindowPos(vo_window, layer, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW);
|
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, vo_depthonscreen);
|
|
||||||
|
|
||||||
vo_w32_release_dc(vo_window, vo_hdc);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,6 +438,9 @@ static char *get_display_name(void) {
|
|||||||
* \return 1 = Success, 0 = Failure
|
* \return 1 = Success, 0 = Failure
|
||||||
*/
|
*/
|
||||||
int vo_w32_init(void) {
|
int vo_w32_init(void) {
|
||||||
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
HDC vo_hdc;
|
||||||
|
int pf;
|
||||||
HICON mplayerIcon = 0;
|
HICON mplayerIcon = 0;
|
||||||
char exedir[MAX_PATH];
|
char exedir[MAX_PATH];
|
||||||
HINSTANCE user32;
|
HINSTANCE user32;
|
||||||
@ -517,6 +497,26 @@ int vo_w32_init(void) {
|
|||||||
if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL);
|
if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL);
|
||||||
updateScreenProperties();
|
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, vo_depthonscreen);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user