[vlc-devel] [vlc-commits] direct3d9: Fix subpictures display.

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue May 23 20:01:36 CEST 2017


On Tue, May 23, 2017, at 06:55 PM, Hugo Beauzée-Luyssen wrote:
> vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue May
> 23 18:00:48 2017 +0200| [012bf0804c5517371833214f9045f923d447b516] |
> committer: Hugo Beauzée-Luyssen
> 
> direct3d9: Fix subpictures display.
> 
> This partially reverts 52799c39e166b249df73b376bd3a18bb486367e1
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=012bf0804c5517371833214f9045f923d447b516
> ---
> 
>  modules/video_output/win32/direct3d9.c | 30
>  ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/modules/video_output/win32/direct3d9.c
> b/modules/video_output/win32/direct3d9.c
> index d0700d249c..e06f007cb9 100644
> --- a/modules/video_output/win32/direct3d9.c
> +++ b/modules/video_output/win32/direct3d9.c
> @@ -1620,8 +1620,8 @@ static void
> Direct3D9ImportSubpicture(vout_display_t *vd,
>              d3d_region_t *cache = &sys->d3dregion[j];
>              if (cache->texture &&
>                  cache->format == sys->d3dregion_format &&
> -                cache->width  == r->fmt.i_width &&
> -                cache->height == r->fmt.i_height) {
> +                cache->width  == r->fmt.i_visible_width &&
> +                cache->height == r->fmt.i_visible_height) {
>                  *d3dr = *cache;
>                  memset(cache, 0, sizeof(*cache));
>                  break;
> @@ -1629,8 +1629,8 @@ static void
> Direct3D9ImportSubpicture(vout_display_t *vd,
>          }
>          if (!d3dr->texture) {
>              d3dr->format = sys->d3dregion_format;
> -            d3dr->width  = r->fmt.i_width;
> -            d3dr->height = r->fmt.i_height;
> +            d3dr->width  = r->fmt.i_visible_width;
> +            d3dr->height = r->fmt.i_visible_height;
>              hr = IDirect3DDevice9_CreateTexture(sys->d3ddev,
>                                                  d3dr->width,
>                                                  d3dr->height,
>                                                  1,
> @@ -1647,7 +1647,7 @@ static void
> Direct3D9ImportSubpicture(vout_display_t *vd,
>              }
>  #ifndef NDEBUG
>              msg_Dbg(vd, "Created %dx%d texture for OSD",
> -                    r->fmt.i_width, r->fmt.i_height);
> +                    r->fmt.i_visible_width, r->fmt.i_visible_height);
>  #endif
>          }
>  
> @@ -1656,21 +1656,23 @@ static void
> Direct3D9ImportSubpicture(vout_display_t *vd,
>          if (SUCCEEDED(hr)) {
>              uint8_t  *dst_data   = lock.pBits;
>              int       dst_pitch  = lock.Pitch;
> -            uint8_t  *src_data   = r->p_picture->p->p_pixels;
> +            const int src_offset = r->fmt.i_y_offset *
> r->p_picture->p->i_pitch +
> +                                   r->fmt.i_x_offset *
> r->p_picture->p->i_pixel_pitch;
> +            uint8_t  *src_data   =
> &r->p_picture->p->p_pixels[src_offset];
>              int       src_pitch  = r->p_picture->p->i_pitch;
>  
>              if (d3dr->format == D3DFMT_A8B8G8R8) {
> -                if (dst_pitch == r->p_picture->p->i_pitch) {
> -                    memcpy(dst_data, src_data, r->fmt.i_height *
> dst_pitch);
> +                if (dst_pitch == r->p_picture->p->i_visible_pitch) {
> +                    memcpy(dst_data, src_data, r->fmt.i_visible_height *
> dst_pitch);
>                  } else {
> -                    int copy_pitch = __MIN(dst_pitch,
> r->p_picture->p->i_pitch);
> -                    for (unsigned y = 0; y < r->fmt.i_height; y++) {
> +                    int copy_pitch = __MIN(dst_pitch,
> r->p_picture->p->i_visible_pitch);
> +                    for (unsigned y = 0; y < r->fmt.i_visible_height;
> y++) {
>                          memcpy(&dst_data[y * dst_pitch], &src_data[y *
>                          src_pitch], copy_pitch);
>                      }
>                  }
>              } else {
> -                int copy_pitch = __MIN(dst_pitch,
> r->p_picture->p->i_pitch);
> -                for (unsigned y = 0; y < r->fmt.i_height; y++) {
> +                int copy_pitch = __MIN(dst_pitch,
> r->p_picture->p->i_visible_pitch);
> +                for (unsigned y = 0; y < r->fmt.i_visible_height; y++) {
>                      for (int x = 0; x < copy_pitch; x += 4) {
>                          dst_data[y * dst_pitch + x + 0] = src_data[y *
>                          src_pitch + x + 2];
>                          dst_data[y * dst_pitch + x + 1] = src_data[y *
>                          src_pitch + x + 1];
> @@ -1693,9 +1695,9 @@ static void
> Direct3D9ImportSubpicture(vout_display_t *vd,
>  
>          RECT dst;
>          dst.left   = video.left + scale_w * r->i_x,
> -        dst.right  = dst.left + scale_w * r->fmt.i_width,
> +        dst.right  = dst.left + scale_w * r->fmt.i_visible_width,
>          dst.top    = video.top  + scale_h * r->i_y,
> -        dst.bottom = dst.top  + scale_h * r->fmt.i_height,
> +        dst.bottom = dst.top  + scale_h * r->fmt.i_visible_height,
>          Direct3D9SetupVertices(d3dr->vertex, NULL, NULL,
>                                &dst, subpicture->i_alpha * r->i_alpha /
>                                255, ORIENT_NORMAL);
>      }
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits

Hi,

This commit was wrong, and has been deleted. Sorry about that (and the
previous push force to "fix" this commit)

Regards,

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list