direct3d9: Don't copy from an odd offset
authorHugo Beauzée-Luyssen <hugo@beauzee.fr>
Wed, 31 May 2017 16:31:19 +0000 (18:31 +0200)
committerHugo Beauzée-Luyssen <hugo@beauzee.fr>
Thu, 1 Jun 2017 09:54:25 +0000 (11:54 +0200)
This can (and often will) make StretchRect fail

modules/video_output/win32/direct3d9.c

index 002cd92..dacc850 100644 (file)
@@ -1566,7 +1566,9 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
     // When copying the entire buffer, the margin end up being blended in the actual picture
     // on nVidia (regardless of even/odd dimensions)
     if ( copy_rect.right & 1 ) copy_rect.right++;
+    if ( copy_rect.left & 1 ) copy_rect.left--;
     if ( copy_rect.bottom & 1 ) copy_rect.bottom++;
+    if ( copy_rect.top & 1 ) copy_rect.top--;
     hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &copy_rect, destination,
                                       &copy_rect, D3DTEXF_NONE);
     IDirect3DSurface9_Release(destination);