[vlc-commits] d3d9: Don't ignore source offsets

Hugo Beauzée-Luyssen git at videolan.org
Tue May 23 20:26:13 CEST 2017


vlc/vlc-2.2 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue May 23 20:07:38 2017 +0200| [cdebc9733679ea95b003485ff7435da66e7fc413] | committer: Hugo Beauzée-Luyssen

d3d9: Don't ignore source offsets

(cherry picked from commit a0f1bfc2f21899e08717ea89c88ca7c4260f0809)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/video_output/msw/direct3d.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index 4b8653e913..1fab5c23ca 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -1410,17 +1410,22 @@ static void Direct3DSetupVertices(CUSTOMVERTEX *vertices,
         vertices[i].y  = vertices_coords[vertex_order[i]][1];
     }
 
-    vertices[0].tu = .0f;
-    vertices[0].tv = .0f;
+    float right = has_src ? (float)src_clipped->right / (float)src->right : 1.0f;
+    float left = has_src ? (float)src_clipped->left / (float)src->right : .0f;
+    float top = has_src ? (float)src_clipped->top / (float)src->bottom : .0f;
+    float bottom = has_src ? (float)src_clipped->bottom / (float)src->bottom : 1.0f;
 
-    vertices[1].tu = has_src ? (float)src_clipped->right / (float)src->right : 1.0f;
-    vertices[1].tv = .0f;
+    vertices[0].tu = left;
+    vertices[0].tv = top;
 
-    vertices[2].tu = has_src ? (float)src_clipped->right / (float)src->right : 1.0f;
-    vertices[2].tv = has_src ? ((float)src_clipped->bottom) / (float)src->bottom : 1.0f;
+    vertices[1].tu = right;
+    vertices[1].tv = top;
 
-    vertices[3].tu = .0f;
-    vertices[3].tv = has_src ? ((float)src_clipped->bottom) / (float)src->bottom : 1.0f;
+    vertices[2].tu = right;
+    vertices[2].tv = bottom;
+
+    vertices[3].tu = left;
+    vertices[3].tv = bottom;
 
     for (int i = 0; i < 4; i++) {
         /* -0.5f is a "feature" of DirectX and it seems to apply to Direct3d also */



More information about the vlc-commits mailing list