[MPlayer-cvslog] CVS: main/libvo vo_gl.c, 1.64, 1.65 vo_gl2.c, 1.62, 1.63 w32_common.c, 1.8, 1.9

Reimar Döffinger CVS syncmail at mplayerhq.hu
Mon Feb 21 15:44:42 CET 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv14869/libvo

Modified Files:
	vo_gl.c vo_gl2.c w32_common.c 
Log Message:
Remove a lot of duplicate code


Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- vo_gl.c	19 Feb 2005 20:13:59 -0000	1.64
+++ vo_gl.c	21 Feb 2005 14:44:39 -0000	1.65
@@ -12,16 +12,9 @@
 #include "font_load.h"
 #include "sub.h"
 
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-//#include <X11/keysym.h>
-#include <GL/glx.h>
 #include <errno.h>
 
-#include <GL/gl.h>
-
 #include "gl_common.h"
-#include "x11_common.h"
 #include "aspect.h"
 #ifdef HAVE_NEW_GUI
 #include "Gui/interface.h"

Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- vo_gl2.c	29 Dec 2004 14:35:18 -0000	1.62
+++ vo_gl2.c	21 Feb 2005 14:44:39 -0000	1.63
@@ -20,23 +20,9 @@
 #include "Gui/interface.h"
 #endif
 
-#include <GL/gl.h>
-#ifdef GL_WIN32
-    #include <windows.h>
-    #include <GL/glext.h>
-#else
-    #include <X11/Xlib.h>
-    #include <X11/Xutil.h>
-    #include <GL/glx.h>
-#endif
 #include <errno.h>
 
 #include "gl_common.h"
-#ifdef GL_WIN32
-    #include "w32_common.h"
-#else
-    #include "x11_common.h"
-#endif
 #include "aspect.h"
 
 #define NDEBUG
@@ -632,7 +618,6 @@
     vo_dwidth = d_width;
     vo_dheight = d_height;
 
-    destroyRenderingContext();
     if (!createRenderingContext())
 	return -1;
 

Index: w32_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/w32_common.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- w32_common.c	11 Dec 2004 16:57:42 -0000	1.8
+++ w32_common.c	21 Feb 2005 14:44:39 -0000	1.9
@@ -106,6 +106,22 @@
     return r;
 }
 
+static void updateScreenProperties() {
+    DEVMODE dm;
+    dm.dmSize = sizeof dm;
+    dm.dmDriverExtra = 0;
+    dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
+    if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm)) {
+	mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to enumerate display settings!\n");
+	return;
+    }
+
+    vo_screenwidth = dm.dmPelsWidth;
+    vo_screenheight = dm.dmPelsHeight;
+    vo_depthonscreen = dm.dmBitsPerPel;
+    aspect_save_screenres(vo_screenwidth, vo_screenheight);
+}
+
 static void changeMode(void) {
     DEVMODE dm;
     dm.dmSize = sizeof dm;
@@ -134,38 +150,14 @@
 
 	if (bestMode != -1)
 	    EnumDisplaySettings(0, bestMode, &dm);
-    }
-
-    vo_screenwidth = dm.dmPelsWidth;
-    vo_screenheight = dm.dmPelsHeight;
-    aspect_save_screenres(vo_screenwidth, vo_screenheight);
-    vo_dwidth = vo_screenwidth;
-    vo_dheight = vo_screenheight;
 
-    if (vo_vm)
     ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
+    }
 }
 
 static void resetMode(void) {
     if (vo_vm)
     ChangeDisplaySettings(0, 0);
-
-    DEVMODE dm;
-    dm.dmSize = sizeof dm;
-    dm.dmDriverExtra = 0;
-    dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-    if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm)) {
-	mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to enumerate display settings!\n");
-	return;
-    }
-
-    vo_screenwidth = dm.dmPelsWidth;
-    vo_screenheight = dm.dmPelsHeight;
-    vo_depthonscreen = dm.dmBitsPerPel;
-    aspect_save_screenres(vo_screenwidth, vo_screenheight);
-
-    vo_dwidth = o_dwidth;
-    vo_dheight = o_dheight;
 }
 
 int createRenderingContext(void) {
@@ -174,19 +166,21 @@
     if (vo_fs || vo_ontop) layer = HWND_TOPMOST;
     if (vo_fs) {
 	changeMode();
-	SetWindowPos(vo_window, layer, 0, 0, vo_screenwidth, vo_screenheight, SWP_SHOWWINDOW);
 	if (cursor) {
 	    ShowCursor(0);
 	    cursor = 0;
 	}
     } else {
 	resetMode();
-	SetWindowPos(vo_window, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
 	if (!cursor) {
 	    ShowCursor(1);
 	    cursor = 1;
 	}
     }
+    updateScreenProperties();
+    vo_dwidth = vo_fs ? vo_screenwidth : o_dwidth;
+    vo_dheight = vo_fs ? vo_screenheight : o_dheight;
+    SetWindowPos(vo_window, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
 
     PIXELFORMATDESCRIPTOR pfd;
     memset(&pfd, 0, sizeof pfd);
@@ -209,14 +203,9 @@
     return 1;
 }
 
-void destroyRenderingContext(void) {
-	resetMode();
-}
-
 int vo_init(void) {
     HICON 	mplayerIcon = 0;
     char 	exedir[MAX_PATH];
-    DEVMODE	dm;
 
     if (vo_window)
 	return 1;
@@ -243,16 +232,7 @@
 
     vo_hdc = GetDC(vo_window);
 
-    dm.dmSize = sizeof dm;
-    dm.dmDriverExtra = 0;
-    dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-    if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm)) {
-	mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to enumerate display settings!\n");
-	return 0;
-    }
-    vo_screenwidth = dm.dmPelsWidth;
-    vo_screenheight = dm.dmPelsHeight;
-    vo_depthonscreen = dm.dmBitsPerPel;
+    updateScreenProperties();
 
     return 1;
 }
@@ -260,7 +240,6 @@
 void vo_w32_fullscreen(void) {
     vo_fs = !vo_fs;
 
-    destroyRenderingContext();
     createRenderingContext();
 }
 
@@ -279,7 +258,6 @@
     resetMode();
     ShowCursor(1);
     vo_depthonscreen = 0;
-    destroyRenderingContext();
     DestroyWindow(vo_window);
     vo_window = 0;
     UnregisterClass(classname, 0);




More information about the MPlayer-cvslog mailing list