[vlc-devel] commit: Added AlignRect helper (msw). (Laurent Aimar )

git version control git at videolan.org
Tue Jan 5 21:07:25 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Jan  5 20:58:09 2010 +0100| [b78fa59350cba973c0dd32bff206e82c01cb7c0b] | committer: Laurent Aimar 

Added AlignRect helper (msw).

It applies hardware overlay constraints on a RECT.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b78fa59350cba973c0dd32bff206e82c01cb7c0b
---

 modules/video_output/msw/common.c |   37 ++++++++++++-------------------------
 modules/video_output/msw/common.h |    1 +
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c
index 779f2eb..dcb95e9 100644
--- a/modules/video_output/msw/common.c
+++ b/modules/video_output/msw/common.c
@@ -222,6 +222,14 @@ void CommonDisplay(vout_display_t *vd)
     sys->is_first_display = false;
 }
 
+void AlignRect(RECT *r, int align_boundary, int align_size)
+{
+    if (align_boundary)
+        r->left = (r->left + align_boundary/2) & ~align_boundary;
+    if (align_size)
+        r->right = ((r->right - r->left + align_size/2) & ~align_size) + r->left;
+}
+
 /*****************************************************************************
  * UpdateRects: update clipping rectangles
  *****************************************************************************
@@ -300,18 +308,8 @@ void UpdateRects(vout_display_t *vd,
 
 #ifdef MODULE_NAME_IS_directx
     /* Apply overlay hardware constraints */
-    if (sys->use_overlay) {
-        if (sys->i_align_dest_boundary)
-            rect_dest.left = (rect_dest.left +
-                              sys->i_align_dest_boundary / 2) &
-                                        ~sys->i_align_dest_boundary;
-
-        if (sys->i_align_dest_size)
-            rect_dest.right = ((rect_dest.right -
-                                rect_dest.left +
-                                sys->i_align_dest_size / 2) &
-                                    ~sys->i_align_dest_size) + rect_dest.left;
-    }
+    if (sys->use_overlay)
+        AlignRect(&rect_dest, sys->i_align_dest_boundary, sys->i_align_dest_size);
 #endif
 
 #endif
@@ -373,19 +371,8 @@ void UpdateRects(vout_display_t *vd,
 
 #ifdef MODULE_NAME_IS_directx
     /* Apply overlay hardware constraints */
-    if (sys->use_overlay) {
-        if (sys->i_align_src_boundary)
-            rect_src_clipped.left =
-                (rect_src_clipped.left +
-                 sys->i_align_src_boundary / 2) &
-                            ~sys->i_align_src_boundary;
-
-        if (sys->i_align_src_size)
-            rect_src_clipped.right =
-                ((rect_src_clipped.right - rect_src_clipped.left +
-                  sys->i_align_src_size / 2) &
-                            ~sys->i_align_src_size) + rect_src_clipped.left;
-    }
+    if (sys->use_overlay)
+        AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size);
 #elif defined(MODULE_NAME_IS_direct3d)
     /* Needed at least with YUV content */
     rect_src_clipped.left &= ~1;
diff --git a/modules/video_output/msw/common.h b/modules/video_output/msw/common.h
index 5372f0a..3749eaf 100644
--- a/modules/video_output/msw/common.h
+++ b/modules/video_output/msw/common.h
@@ -241,6 +241,7 @@ void UpdateRects (vout_display_t *,
                   const vout_display_cfg_t *,
                   const video_format_t *,
                   bool is_forced);
+void AlignRect(RECT *, int align_boundary, int align_size);
 
 /*****************************************************************************
  * Constants




More information about the vlc-devel mailing list