summaryrefslogtreecommitdiffstats
path: root/libvo/vo_direct3d.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-27 22:10:32 +0200
committerwm4 <wm4@nowhere>2012-11-01 02:07:46 +0100
commit6f408d0d9d6d0655faec75474bc3074812b41826 (patch)
tree973ef09419d166790c4d909eb2bd90d8709278ab /libvo/vo_direct3d.c
parent3466057febaf5790b3ce88db1726058d9852f28d (diff)
downloadmpv-6f408d0d9d6d0655faec75474bc3074812b41826.tar.bz2
mpv-6f408d0d9d6d0655faec75474bc3074812b41826.tar.xz
VO: remove code duplication for setting up mp_osd_res
vo_opengl, vo_vdpau, vo_direct3d had the code for setting up mp_osd_res duplicated. Make things simpler by making calc_src_dst_rects() setup the full mp_osd_res structure, instead of just "borders". Also, rename that function to vo_get_src_dst_rects(), and make it use mp_rect. Remove vo_rect, which was annoying because it contains redundant members (width/height additional to right/bottom). Add code to print the video rect etc. in verbose mode. There should be no actual change how the video rects are calculated. The only exception are the bottom/right subtitle margins, which are now computed slightly differently, but that shouldn't matter.
Diffstat (limited to 'libvo/vo_direct3d.c')
-rw-r--r--libvo/vo_direct3d.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index 5fc2a64893..294a101ffe 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -145,8 +145,7 @@ typedef struct d3d_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 */
+ struct mp_osd_res osd_res;
int image_format; /**< mplayer image format */
bool use_textures; /**< use 3D texture rendering, instead of
StretchRect */
@@ -294,22 +293,18 @@ static bool d3d_begin_scene(d3d_priv *priv)
*/
static void calc_fs_rect(d3d_priv *priv)
{
- struct vo_rect src_rect;
- struct vo_rect dst_rect;
- struct vo_rect borders;
- calc_src_dst_rects(priv->vo, 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;
- priv->fs_movie_rect.top = dst_rect.top;
- priv->fs_movie_rect.bottom = dst_rect.bottom;
- priv->fs_panscan_rect.left = src_rect.left;
- 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;
+ struct mp_rect src_rect;
+ struct mp_rect dst_rect;
+ vo_get_src_dst_rects(priv->vo, &src_rect, &dst_rect, &priv->osd_res);
+
+ priv->fs_movie_rect.left = dst_rect.x0;
+ priv->fs_movie_rect.right = dst_rect.x1;
+ priv->fs_movie_rect.top = dst_rect.y0;
+ priv->fs_movie_rect.bottom = dst_rect.y1;
+ priv->fs_panscan_rect.left = src_rect.x0;
+ priv->fs_panscan_rect.right = src_rect.x1;
+ priv->fs_panscan_rect.top = src_rect.y0;
+ priv->fs_panscan_rect.bottom = src_rect.y1;
mp_msg(MSGT_VO, MSGL_V,
"<vo_direct3d>Video rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",
@@ -2063,18 +2058,8 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
if (!priv->d3d_device)
return;
- struct mp_osd_res res = {
- .w = vo->dwidth,
- .h = vo->dheight,
- .ml = priv->border_x,
- .mr = priv->border_x,
- .mt = priv->border_y,
- .mb = priv->border_y,
- .display_par = vo->monitor_par,
- .video_par = vo->aspdat.par,
- };
-
- osd_draw(osd, res, osd->vo_pts, 0, osd_fmt_supported, draw_osd_cb, priv);
+ osd_draw(osd, priv->osd_res, osd->vo_pts, 0, osd_fmt_supported,
+ draw_osd_cb, priv);
}
#define AUTHOR "Georgi Petrov (gogothebee) <gogothebee@gmail.com> and others"