]> git.sesse.net Git - vlc/blobdiff - modules/video_output/directx/events.c
backport [13049] and [13059]
[vlc] / modules / video_output / directx / events.c
index f5e9113593e72a71a0960377fd84ddd4551c4de6..f7dd749071f630c66014cf6cf917e1232627d4ae 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * events.c: Windows DirectX video output events handler
  *****************************************************************************
- * Copyright (C) 2001-2004 VideoLAN (Centrale Réseaux) and its contributors
+ * Copyright (C) 2001-2004 the VideoLAN team
  * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
@@ -144,11 +144,13 @@ void E_(DirectXEventThread)( event_thread_t *p_event )
 
             if( i_width && i_height )
             {
-                val.i_int = ( GET_X_LPARAM(msg.lParam) - i_x )
-                             * p_event->p_vout->render.i_width / i_width;
+                val.i_int = ( GET_X_LPARAM(msg.lParam) - i_x ) *
+                    p_event->p_vout->fmt_in.i_visible_width / i_width +
+                    p_event->p_vout->fmt_in.i_x_offset;
                 var_Set( p_event->p_vout, "mouse-x", val );
-                val.i_int = ( GET_Y_LPARAM(msg.lParam) - i_y )
-                             * p_event->p_vout->render.i_height / i_height;
+                val.i_int = ( GET_Y_LPARAM(msg.lParam) - i_y ) *
+                    p_event->p_vout->fmt_in.i_visible_height / i_height +
+                    p_event->p_vout->fmt_in.i_y_offset;
                 var_Set( p_event->p_vout, "mouse-y", val );
 
                 val.b_bool = VLC_TRUE;
@@ -649,16 +651,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 )
@@ -894,12 +900,10 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
             return vout_ControlWindow( p_vout,
                     (void *)p_vout->p_sys->hparent, i_query, args );
 
-        f_arg = va_arg( args, double );
-
         /* Update dimensions */
         rect_window.top = rect_window.left = 0;
-        rect_window.right  = p_vout->i_window_width * f_arg;
-        rect_window.bottom = p_vout->i_window_height * f_arg;
+        rect_window.right  = p_vout->i_window_width;
+        rect_window.bottom = p_vout->i_window_height;
         AdjustWindowRect( &rect_window, p_vout->p_sys->i_window_style, 0 );
 
         SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,