[RFC PATCH v2 4/7] win32u: fix return value of SetDIBitsToDevice for EMF DC.

Jinoh Kang jinoh.kang.kr at gmail.com
Sat Oct 16 14:19:48 CDT 2021


Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---

Notes:
    In my local Windows 10 box, SetDIBitsToDevice seems to always
    return *zero* when a top-down DIB is used as the source, even through
    the EMRSETDIBITSDEVICE record is still emitted correctly.
    
    As I couldn't find a reasonable explanation for this behaviour,
    the top-down DIB case is left unmodified.

 dlls/win32u/emfdrv.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dlls/win32u/emfdrv.c b/dlls/win32u/emfdrv.c
index 395d51048d8..238f6359449 100644
--- a/dlls/win32u/emfdrv.c
+++ b/dlls/win32u/emfdrv.c
@@ -416,6 +416,15 @@ static INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DW
                                            UINT lines, const void *bits, BITMAPINFO *info,
                                            UINT usage )
 {
+    UINT src_height;
+
+    if (info->bmiHeader.biHeight >= 0)
+    {
+        src_height = (UINT)info->bmiHeader.biHeight;
+        if (src_height > y_src + height) src_height = y_src + height;
+        if (lines > src_height - startscan) lines = src_height - startscan;
+    }
+
     /* FIXME: Update bound rect */
     return lines;
 }
-- 
2.31.1




More information about the wine-devel mailing list