1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-22 15:56:59 +00:00

Factor calc_drwXY out of vo_xv and vo_xvmc.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28285 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
cehoyos 2009-01-09 15:25:24 +00:00
parent 84b4007802
commit 0fa2d1abd7
4 changed files with 22 additions and 35 deletions

View File

@ -140,22 +140,6 @@ static void draw_alpha_null(int x0, int y0, int w, int h,
static void deallocate_xvimage(int foo);
static void calc_drwXY(uint32_t *drwX, uint32_t *drwY) {
*drwX = *drwY = 0;
if (vo_fs) {
aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
vo_dheight = FFMIN(vo_dheight, vo_screenheight);
*drwX = (vo_screenwidth - vo_dwidth) / 2;
*drwY = (vo_screenheight - vo_dheight) / 2;
mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",
*drwX, *drwY, vo_dwidth, vo_dheight);
} else if (WinID == 0) {
*drwX = vo_dx;
*drwY = vo_dy;
}
}
/*
* connect to server, create and map window,
* allocate colors and (shared) memory
@ -286,7 +270,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
current_ip_buf = 0;
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1;
calc_drwXY(&drwX, &drwY);
vo_calc_drwXY(&drwX, &drwY);
panscan_calc();
@ -391,7 +375,7 @@ static void check_events(void)
if (e & VO_EVENT_RESIZE)
{
calc_drwXY(&drwX, &drwY);
vo_calc_drwXY(&drwX, &drwY);
}
if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)

View File

@ -431,22 +431,6 @@ opt_t subopts [] =
return 0;
}
static void calc_drwXY(uint32_t *drwX, uint32_t *drwY) {
*drwX = *drwY = 0;
if (vo_fs) {
aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
vo_dheight = FFMIN(vo_dheight, vo_screenheight);
*drwX = (vo_screenwidth - vo_dwidth) / 2;
*drwY = (vo_screenheight - vo_dheight) / 2;
mp_msg(MSGT_VO, MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n",
*drwX, *drwY, vo_dwidth, vo_dheight);
} else if (WinID == 0) {
*drwX = vo_dx;
*drwY = vo_dy;
}
}
static int config(uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height,
uint32_t flags, char *title, uint32_t format){
@ -674,7 +658,7 @@ skip_surface_allocation:
}
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1;
calc_drwXY(&drwX, &drwY);
vo_calc_drwXY(&drwX, &drwY);
panscan_calc();

View File

@ -8,6 +8,7 @@
#include "config.h"
#include "mp_msg.h"
#include "mp_fifo.h"
#include "libavutil/common.h"
#include "x11_common.h"
#ifdef X11_FULLSCREEN
@ -1854,6 +1855,23 @@ uint32_t vo_x11_get_equalizer(char *name, int *value)
return VO_TRUE;
}
void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY)
{
*drwX = *drwY = 0;
if (vo_fs) {
aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
vo_dheight = FFMIN(vo_dheight, vo_screenheight);
*drwX = (vo_screenwidth - vo_dwidth) / 2;
*drwY = (vo_screenheight - vo_dheight) / 2;
mp_msg(MSGT_VO, MSGL_V, "[vo-fs] dx: %d dy: %d dw: %d dh: %d\n",
*drwX, *drwY, vo_dwidth, vo_dheight);
} else if (WinID == 0) {
*drwX = vo_dx;
*drwY = vo_dy;
}
}
#ifdef CONFIG_XV
int vo_xv_set_eq(uint32_t xv_port, char *name, int value)
{

View File

@ -129,5 +129,6 @@ void vo_vm_close(void);
void update_xinerama_info(void);
int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return);
void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY);
#endif /* MPLAYER_X11_COMMON_H */