From: Jan Schmidt Subject: [PATCH 2/4] quartz: Images in Direct3D surfaces must be top-down Message-Id: <1468989432-519-2-git-send-email-jan@centricular.com> Date: Wed, 20 Jul 2016 14:37:10 +1000 In-Reply-To: <1468989432-519-1-git-send-email-jan@centricular.com> References: <1468989432-519-1-git-send-email-jan@centricular.com> Invert images when copying to a Direct3D surface if they are provided bottom-up. Signed-off-by: Jan Schmidt --- 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