summaryrefslogtreecommitdiffstats
path: root/libvo/vo_direct3d.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-12 17:40:53 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-12 17:40:53 +0000
commit694c3dc03f157eb62442fb2f24118f2ae4432ec7 (patch)
treebb97f3f9bd760f87c4b48f42ae61ccc07ffd33c4 /libvo/vo_direct3d.c
parent8c2821f32d62e6a2a6f6df99b366d1a2ba40fdd3 (diff)
downloadmpv-694c3dc03f157eb62442fb2f24118f2ae4432ec7.tar.bz2
mpv-694c3dc03f157eb62442fb2f24118f2ae4432ec7.tar.xz
Add a calc_src_dst_rects that calculates from window size, panscan etc.
which part of the video source must be scaled onto which part of the window. Direct3D and (future) VDPAU need this, for XvMC it makes it easier to add cropping support and Xv is changed to keep the diff to XvMC small. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28546 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/vo_direct3d.c')
-rw-r--r--libvo/vo_direct3d.c53
1 files changed, 12 insertions, 41 deletions
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index 48287c238f..c2955f2d44 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -147,47 +147,18 @@ typedef enum back_buffer_action {
*/
static void calc_fs_rect(void)
{
- int scaled_height = 0;
- int scaled_width = 0;
-
- // set default values
- priv->fs_movie_rect.left = 0;
- priv->fs_movie_rect.right = vo_dwidth;
- priv->fs_movie_rect.top = 0;
- priv->fs_movie_rect.bottom = vo_dheight;
- priv->fs_panscan_rect.left = 0;
- priv->fs_panscan_rect.right = priv->src_width;
- priv->fs_panscan_rect.top = 0;
- priv->fs_panscan_rect.bottom = priv->src_height;
- if (!vo_fs)
- return;
-
- // adjust for fullscreen aspect and panscan
- aspect(&scaled_width, &scaled_height, A_ZOOM);
- panscan_calc();
- scaled_width += vo_panscan_x;
- scaled_height += vo_panscan_y;
-
- // note: border is rounded to a multiple of two since at least
- // ATI drivers can not handle odd values with YV12 input
- if (scaled_width > vo_dwidth) {
- int border = priv->src_width * (scaled_width - vo_dwidth) / scaled_width;
- border = (border / 2 + 1) & ~1;
- priv->fs_panscan_rect.left = border;
- priv->fs_panscan_rect.right = priv->src_width - border;
- } else {
- priv->fs_movie_rect.left = (vo_dwidth - scaled_width) / 2;
- priv->fs_movie_rect.right = priv->fs_movie_rect.left + scaled_width;
- }
- if (scaled_height > vo_dheight) {
- int border = priv->src_height * (scaled_height - vo_dheight) / scaled_height;
- border = (border / 2 + 1) & ~1;
- priv->fs_panscan_rect.top = border;
- priv->fs_panscan_rect.bottom = priv->src_height - border;
- } else {
- priv->fs_movie_rect.top = (vo_dheight - scaled_height) / 2;
- priv->fs_movie_rect.bottom = priv->fs_movie_rect.top + scaled_height;
- }
+ 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);
+
+ 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;
mp_msg(MSGT_VO, MSGL_V,
"<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",