Commit 883daa52 authored by Gildas Bazin's avatar Gildas Bazin

* modules/video_output/directx/*: support for cropping.

parent d35b01cc
...@@ -356,6 +356,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -356,6 +356,7 @@ static int Init( vout_thread_t *p_vout )
p_vout->output.i_width = p_vout->render.i_width; p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height; p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; p_vout->output.i_aspect = p_vout->render.i_aspect;
p_vout->fmt_out = p_vout->fmt_in;
#define MAX_DIRECTBUFFERS 1 #define MAX_DIRECTBUFFERS 1
/* Right now we use only 1 directbuffer because we don't want the /* Right now we use only 1 directbuffer because we don't want the
...@@ -413,6 +414,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -413,6 +414,7 @@ static int Init( vout_thread_t *p_vout )
/* Change the window title bar text */ /* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 ); PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -1223,14 +1225,16 @@ int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout ) ...@@ -1223,14 +1225,16 @@ int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout )
RECT rect_dest = p_vout->p_sys->rect_dest_clipped; RECT rect_dest = p_vout->p_sys->rect_dest_clipped;
if( !p_vout->p_sys->b_using_overlay ) return VLC_EGENERIC; if( !p_vout->p_sys->b_using_overlay ) return VLC_EGENERIC;
msg_Err( p_vout, "update overlay");
if( p_vout->p_sys->b_wallpaper ) if( p_vout->p_sys->b_wallpaper )
{ {
int i_x, i_y, i_width, i_height; int i_x, i_y, i_width, i_height;
rect_src.left = rect_src.top = 0; rect_src.left = p_vout->fmt_out.i_x_offset;
rect_src.right = p_vout->render.i_width; rect_src.top = p_vout->fmt_out.i_y_offset;
rect_src.bottom = p_vout->render.i_height; rect_src.right = rect_src.left + p_vout->fmt_out.i_visible_width;
rect_src.bottom = rect_src.top + p_vout->fmt_out.i_visible_height;
rect_dest = p_vout->p_sys->rect_display; rect_dest = p_vout->p_sys->rect_display;
vout_PlacePicture( p_vout, rect_dest.right, rect_dest.bottom, vout_PlacePicture( p_vout, rect_dest.right, rect_dest.bottom,
......
...@@ -649,16 +649,20 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force ) ...@@ -649,16 +649,20 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
rect_src.bottom = p_vout->render.i_height; rect_src.bottom = p_vout->render.i_height;
/* Clip the source image */ /* Clip the source image */
rect_src_clipped.left = (rect_dest_clipped.left - rect_dest.left) * rect_src_clipped.left = p_vout->fmt_out.i_x_offset +
p_vout->render.i_width / (rect_dest.right - rect_dest.left); (rect_dest_clipped.left - rect_dest.left) *
rect_src_clipped.right = p_vout->render.i_width - p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
(rect_dest.right - rect_dest_clipped.right) * p_vout->render.i_width / rect_src_clipped.right = p_vout->fmt_out.i_x_offset +
(rect_dest.right - rect_dest.left); p_vout->fmt_out.i_visible_width -
rect_src_clipped.top = (rect_dest_clipped.top - rect_dest.top) * (rect_dest.right - rect_dest_clipped.right) *
p_vout->render.i_height / (rect_dest.bottom - rect_dest.top); p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
rect_src_clipped.bottom = p_vout->render.i_height - rect_src_clipped.top = p_vout->fmt_out.i_y_offset +
(rect_dest.bottom - rect_dest_clipped.bottom) * p_vout->render.i_height / (rect_dest_clipped.top - rect_dest.top) *
(rect_dest.bottom - rect_dest.top); p_vout->fmt_out.i_visible_height / (rect_dest.bottom - rect_dest.top);
rect_src_clipped.bottom = p_vout->fmt_out.i_y_offset +
p_vout->fmt_out.i_visible_height -
(rect_dest.bottom - rect_dest_clipped.bottom) *
p_vout->fmt_out.i_visible_height / (rect_dest.bottom - rect_dest.top);
/* Apply overlay hardware constraints */ /* Apply overlay hardware constraints */
if( p_vout->p_sys->b_using_overlay ) if( p_vout->p_sys->b_using_overlay )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment