summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-02-21 14:44:39 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-02-21 14:44:39 +0000
commitcdfb0214ba6e03f39af9dea94f120c9339838fce (patch)
tree2633655ab8397c9bdf136cf39ca8c07eae22292d /libvo
parented329f9be7c0dc77dbe804971d73c49b101d2656 (diff)
downloadmpv-cdfb0214ba6e03f39af9dea94f120c9339838fce.tar.bz2
mpv-cdfb0214ba6e03f39af9dea94f120c9339838fce.tar.xz
Remove a lot of duplicate code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14748 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl.c7
-rw-r--r--libvo/vo_gl2.c15
-rw-r--r--libvo/w32_common.c66
3 files changed, 22 insertions, 66 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index f84065d868..3011a5ce74 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -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"
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index c4128d7415..03b894171b 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -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 @@ static int config_w32(uint32_t width, uint32_t height, uint32_t d_width, uint32_
vo_dwidth = d_width;
vo_dheight = d_height;
- destroyRenderingContext();
if (!createRenderingContext())
return -1;
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index 13b8839d29..60e38d3555 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -106,6 +106,22 @@ int vo_w32_check_events(void) {
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 @@ static void changeMode(void) {
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 @@ int createRenderingContext(void) {
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 @@ int createRenderingContext(void) {
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 @@ int vo_init(void) {
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 @@ int vo_init(void) {
void vo_w32_fullscreen(void) {
vo_fs = !vo_fs;
- destroyRenderingContext();
createRenderingContext();
}
@@ -279,7 +258,6 @@ void vo_w32_uninit() {
resetMode();
ShowCursor(1);
vo_depthonscreen = 0;
- destroyRenderingContext();
DestroyWindow(vo_window);
vo_window = 0;
UnregisterClass(classname, 0);