mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
Extend calc_src_dst_rects to also calculate the border values needed for
correctly placed dvdnav highlights, and fix direct3d and vdpau accordingly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28633 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a845504a5e
commit
01ef7e4579
@ -387,8 +387,11 @@ static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_siz
|
||||
* Can be extended to take future cropping support into account.
|
||||
*
|
||||
* \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL
|
||||
* \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires,
|
||||
* may be NULL and only left and top are currently valid.
|
||||
*/
|
||||
void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, const struct vo_rect *crop) {
|
||||
void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
|
||||
struct vo_rect *borders, const struct vo_rect *crop) {
|
||||
static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0};
|
||||
int scaled_width = 0;
|
||||
int scaled_height = 0;
|
||||
@ -401,11 +404,18 @@ void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, stru
|
||||
dst->top = 0; dst->bottom = vo_dheight;
|
||||
src->left = 0; src->right = src_width;
|
||||
src->top = 0; src->bottom = src_height;
|
||||
if (borders) {
|
||||
borders->left = 0; borders->top = 0;
|
||||
}
|
||||
if (vo_fs) {
|
||||
aspect(&scaled_width, &scaled_height, A_ZOOM);
|
||||
panscan_calc();
|
||||
scaled_width += vo_panscan_x;
|
||||
scaled_height += vo_panscan_y;
|
||||
if (borders) {
|
||||
borders->left = (vo_dwidth - scaled_width ) / 2;
|
||||
borders->top = (vo_dheight - scaled_height) / 2;
|
||||
}
|
||||
src_dst_split_scaling(src_width, vo_dwidth, scaled_width,
|
||||
&src->left, &src->right, &dst->left, &dst->right);
|
||||
src_dst_split_scaling(src_height, vo_dheight, scaled_height,
|
||||
|
@ -272,6 +272,7 @@ int lookup_keymap_table(const struct keymap *map, int key);
|
||||
struct vo_rect {
|
||||
int left, right, top, bottom, width, height;
|
||||
};
|
||||
void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, const struct vo_rect *crop);
|
||||
void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
|
||||
struct vo_rect *borders, const struct vo_rect *crop);
|
||||
|
||||
#endif /* MPLAYER_VIDEO_OUT_H */
|
||||
|
@ -63,6 +63,8 @@ static struct global_priv {
|
||||
fullscreen */
|
||||
int src_width; /**< Source (movie) width */
|
||||
int src_height; /**< Source (movie) heigth */
|
||||
int border_x; /**< horizontal border value for OSD */
|
||||
int border_y; /**< vertical border value for OSD */
|
||||
|
||||
D3DFORMAT movie_src_fmt; /**< Movie colorspace format (depends on
|
||||
the movie's codec) */
|
||||
@ -149,7 +151,8 @@ static void calc_fs_rect(void)
|
||||
{
|
||||
struct vo_rect src_rect;
|
||||
struct vo_rect dst_rect;
|
||||
calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, NULL);
|
||||
struct vo_rect borders;
|
||||
calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, &borders, NULL);
|
||||
|
||||
priv->fs_movie_rect.left = dst_rect.left;
|
||||
priv->fs_movie_rect.right = dst_rect.right;
|
||||
@ -159,6 +162,8 @@ static void calc_fs_rect(void)
|
||||
priv->fs_panscan_rect.right = src_rect.right;
|
||||
priv->fs_panscan_rect.top = src_rect.top;
|
||||
priv->fs_panscan_rect.bottom = src_rect.bottom;
|
||||
priv->border_x = borders.left;
|
||||
priv->border_y = borders.top;
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_V,
|
||||
"<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",
|
||||
@ -1027,7 +1032,8 @@ static void draw_osd(void)
|
||||
/* required for if subs are in the boarder region */
|
||||
priv->is_clear_needed = 1;
|
||||
|
||||
vo_draw_text(priv->osd_width, priv->osd_height, draw_alpha);
|
||||
vo_draw_text_ext(priv->osd_width, priv->osd_height, priv->border_x, priv->border_y,
|
||||
priv->border_x, priv->border_y, priv->src_width, priv->src_height, draw_alpha);
|
||||
|
||||
if (!priv->device_texture_sys)
|
||||
{
|
||||
|
@ -138,6 +138,7 @@ static int decoder_max_refs;
|
||||
|
||||
static VdpRect src_rect_vid;
|
||||
static VdpRect out_rect_vid;
|
||||
static int border_x, border_y;
|
||||
|
||||
static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES];
|
||||
static int surface_num;
|
||||
@ -184,7 +185,8 @@ static void resize(void)
|
||||
int i;
|
||||
struct vo_rect src_rect;
|
||||
struct vo_rect dst_rect;
|
||||
calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, NULL);
|
||||
struct vo_rect borders;
|
||||
calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, &borders, NULL);
|
||||
out_rect_vid.x0 = dst_rect.left;
|
||||
out_rect_vid.x1 = dst_rect.right;
|
||||
out_rect_vid.y0 = dst_rect.top;
|
||||
@ -193,6 +195,8 @@ static void resize(void)
|
||||
src_rect_vid.x1 = src_rect.right;
|
||||
src_rect_vid.y0 = src_rect.top;
|
||||
src_rect_vid.y1 = src_rect.bottom;
|
||||
border_x = borders.left;
|
||||
border_y = borders.top;
|
||||
#ifdef CONFIG_FREETYPE
|
||||
// adjust font size to display size
|
||||
force_load_font = 1;
|
||||
@ -522,7 +526,8 @@ static void draw_osd(void)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n");
|
||||
|
||||
vo_draw_text(vo_dwidth, vo_dheight, draw_osd_I8A8);
|
||||
vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y,
|
||||
vid_width, vid_height, draw_osd_I8A8);
|
||||
}
|
||||
|
||||
static void flip_page(void)
|
||||
|
@ -161,7 +161,7 @@ static void deallocate_xvimage(int foo);
|
||||
|
||||
static void resize(void)
|
||||
{
|
||||
calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL);
|
||||
calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
|
||||
vo_x11_clearwindow_part(mDisplay, vo_window, dst_rect.width, dst_rect.height, 1);
|
||||
vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
|
||||
}
|
||||
|
@ -943,7 +943,7 @@ int i;
|
||||
if(p_render_surface == NULL)
|
||||
return;
|
||||
|
||||
calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL);
|
||||
calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
|
||||
|
||||
if(draw_ck)
|
||||
vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
|
||||
|
Loading…
Reference in New Issue
Block a user