Commit b78fa593 authored by Laurent Aimar's avatar Laurent Aimar

Added AlignRect helper (msw).

It applies hardware overlay constraints on a RECT.
parent d98e43b1
......@@ -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;
......
......@@ -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
......
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