[PATCH 2/4] quartz: Images in Direct3D surfaces must be top-down

Jan Schmidt jan at centricular.com
Tue Jul 19 23:37:10 CDT 2016


Invert images when copying to a Direct3D surface if
they are provided bottom-up.

Signed-off-by: Jan Schmidt <jan at centricular.com>
---
 dlls/quartz/vmr9.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index f2c3d93..d590a71 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -255,7 +255,17 @@ static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo *
         return hr;
     }
 
-    if (lock.Pitch != width * bmiHeader->biBitCount / 8)
+    if (height > 0) {
+        /* Bottom up image needs inverting */
+        lock.pBits = (char *)lock.pBits + (height * lock.Pitch);
+        while (height--)
+        {
+            memcpy(lock.pBits, data, width * bmiHeader->biBitCount / 8);
+            data = data + width * bmiHeader->biBitCount / 8;
+            lock.pBits = (char *)lock.pBits - lock.Pitch;
+        }
+    }
+    else if (lock.Pitch != width * bmiHeader->biBitCount / 8)
     {
         WARN("Slow path! %u/%u\n", lock.Pitch, width * bmiHeader->biBitCount/8);
 
-- 
2.7.4




More information about the wine-patches mailing list