Skip to content

direct3d11: fix subpicture placement with external rendering

Tung Huynh requested to merge huynhsontung/vlc:fix-subtitle into 3.0.x

Fix subpicture mapping when using external render in direct3d11. Subpicture offsets are always 0 in this case.

explorer_d4IbxhddeI.mp4

Alternative solution

Revert 3b520d80 just for Direct3D11MapSubpicture function. The following works:

quad->cropViewport.Width =  (FLOAT) r->fmt.i_visible_width  * RECTWidth(sys->sys.rect_dest)  / subpicture->i_original_picture_width;
quad->cropViewport.Height = (FLOAT) r->fmt.i_visible_height * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
quad->cropViewport.TopLeftX = sys->sys.rect_dest.left + (FLOAT) r->i_x * RECTWidth(sys->sys.rect_dest) / subpicture->i_original_picture_width;
quad->cropViewport.TopLeftY = sys->sys.rect_dest.top  + (FLOAT) r->i_y * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;

Merge request reports