]> git.sesse.net Git - vlc/commitdiff
* modules/video_output/directx/*: support for cropping.
authorGildas Bazin <gbazin@videolan.org>
Sun, 23 Oct 2005 14:36:33 +0000 (14:36 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 23 Oct 2005 14:36:33 +0000 (14:36 +0000)
modules/video_output/directx/directx.c
modules/video_output/directx/events.c

index 1aba6bf5f0f5dad65966e22bcf74814a3c62b95b..18755bd000bf432104a6d710f0afdbe92f6e4422 100644 (file)
@@ -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_height = p_vout->render.i_height;
     p_vout->output.i_aspect = p_vout->render.i_aspect;
+    p_vout->fmt_out = p_vout->fmt_in;
 
 #define MAX_DIRECTBUFFERS 1
     /* 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 )
     /* Change the window title bar text */
     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;
 }
 
@@ -1223,14 +1225,16 @@ int E_(DirectXUpdateOverlay)( vout_thread_t *p_vout )
     RECT            rect_dest = p_vout->p_sys->rect_dest_clipped;
 
     if( !p_vout->p_sys->b_using_overlay ) return VLC_EGENERIC;
+    msg_Err( p_vout, "update overlay");
 
     if( p_vout->p_sys->b_wallpaper )
     {
         int i_x, i_y, i_width, i_height;
 
-        rect_src.left = rect_src.top = 0;
-        rect_src.right = p_vout->render.i_width;
-        rect_src.bottom = p_vout->render.i_height;
+        rect_src.left = p_vout->fmt_out.i_x_offset;
+        rect_src.top = p_vout->fmt_out.i_y_offset;
+        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;
         vout_PlacePicture( p_vout, rect_dest.right, rect_dest.bottom,
index 0c869a65c662ac2d6bf2230612deb3b91145b199..c2af7e8db31f0b9f535a4ca0a06de1d71d8396dd 100644 (file)
@@ -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;
 
     /* Clip the source image */
-    rect_src_clipped.left = (rect_dest_clipped.left - rect_dest.left) *
-      p_vout->render.i_width / (rect_dest.right - rect_dest.left);
-    rect_src_clipped.right = p_vout->render.i_width -
-      (rect_dest.right - rect_dest_clipped.right) * p_vout->render.i_width /
-      (rect_dest.right - rect_dest.left);
-    rect_src_clipped.top = (rect_dest_clipped.top - rect_dest.top) *
-      p_vout->render.i_height / (rect_dest.bottom - rect_dest.top);
-    rect_src_clipped.bottom = p_vout->render.i_height -
-      (rect_dest.bottom - rect_dest_clipped.bottom) * p_vout->render.i_height /
-      (rect_dest.bottom - rect_dest.top);
+    rect_src_clipped.left = p_vout->fmt_out.i_x_offset +
+      (rect_dest_clipped.left - rect_dest.left) *
+      p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
+    rect_src_clipped.right = p_vout->fmt_out.i_x_offset +
+      p_vout->fmt_out.i_visible_width -
+      (rect_dest.right - rect_dest_clipped.right) *
+      p_vout->fmt_out.i_visible_width / (rect_dest.right - rect_dest.left);
+    rect_src_clipped.top = p_vout->fmt_out.i_y_offset +
+      (rect_dest_clipped.top - 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 */
     if( p_vout->p_sys->b_using_overlay )