[vlc-commits] wgl: refactor PFD initialization

Thomas Guillem git at videolan.org
Fri Nov 10 12:58:51 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Nov 10 12:49:45 2017 +0100| [f26ac5b8bb15d17988acb4c694ca1e286de3ddbd] | committer: Thomas Guillem

wgl: refactor PFD initialization

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f26ac5b8bb15d17988acb4c694ca1e286de3ddbd
---

 modules/video_output/win32/wgl.c | 39 ++++++++++++---------------------------
 1 file changed, 12 insertions(+), 27 deletions(-)

diff --git a/modules/video_output/win32/wgl.c b/modules/video_output/win32/wgl.c
index 3baee6e350..d3ffada8df 100644
--- a/modules/video_output/win32/wgl.c
+++ b/modules/video_output/win32/wgl.c
@@ -73,20 +73,21 @@ static void          *OurGetProcAddress(vlc_gl_t *, const char *);
 static int           MakeCurrent(vlc_gl_t *gl);
 static void          ReleaseCurrent(vlc_gl_t *gl);
 
+#define VLC_PFD_INITIALIZER { \
+    .nSize = sizeof(PIXELFORMATDESCRIPTOR), \
+    .nVersion = 1, \
+    .dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, \
+    .iPixelType = PFD_TYPE_RGBA, \
+    .cColorBits = 24, \
+    .cDepthBits = 16, \
+    .iLayerType = PFD_MAIN_PLANE, \
+}
 
 /* Create an GPU Affinity DC */
 static void CreateGPUAffinityDC(vlc_gl_t *gl, UINT nVidiaAffinity) {
     vout_display_sys_t *sys = gl->sys;
 
-    PIXELFORMATDESCRIPTOR pfd;
-    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.cDepthBits = 16;
-    pfd.iLayerType = PFD_MAIN_PLANE;
+    PIXELFORMATDESCRIPTOR pfd = VLC_PFD_INITIALIZER;
 
     /* create a temporary GL context */
     HDC winDC = GetDC(sys->sys.hvideownd);
@@ -127,15 +128,7 @@ static void DestroyGPUAffinityDC(vlc_gl_t *gl) {
 
     if (sys->affinityHDC == NULL) return;
 
-    PIXELFORMATDESCRIPTOR pfd;
-    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.cDepthBits = 16;
-    pfd.iLayerType = PFD_MAIN_PLANE;
+    PIXELFORMATDESCRIPTOR pfd = VLC_PFD_INITIALIZER;
 
     /* create a temporary GL context */
     HDC winDC = GetDC(sys->sys.hvideownd);
@@ -183,15 +176,7 @@ static int Open(vlc_object_t *object)
     }
 
     /* Set the pixel format for the DC */
-    PIXELFORMATDESCRIPTOR pfd;
-    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.cDepthBits = 16;
-    pfd.iLayerType = PFD_MAIN_PLANE;
+    PIXELFORMATDESCRIPTOR pfd = VLC_PFD_INITIALIZER;
     SetPixelFormat(sys->hGLDC, ChoosePixelFormat(sys->hGLDC, &pfd), &pfd);
 
     /* Create the context. */



More information about the vlc-commits mailing list