Alexandre Julliard : winex11: Fix SetDIBitsToDevice coordinate mapping in RTL mode.

Alexandre Julliard julliard at winehq.org
Thu Sep 1 11:55:57 CDT 2011


Module: wine
Branch: master
Commit: e1ca5c38e2ecfc7fc941ce7c05f8a4077b57681b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e1ca5c38e2ecfc7fc941ce7c05f8a4077b57681b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Sep  1 12:41:00 2011 +0200

winex11: Fix SetDIBitsToDevice coordinate mapping in RTL mode.

---

 dlls/gdi32/tests/bitmap.c |   14 ++++++++++++++
 dlls/winex11.drv/dib.c    |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index d69e463..e7b7d2d 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -4287,6 +4287,20 @@ static void test_SetDIBitsToDevice(void)
     memset( dib_bits, 0xaa, 64 * 4 );
     SetMapMode( hdc, MM_TEXT );
 
+    if (pSetLayout)
+    {
+        pSetLayout( hdc, LAYOUT_RTL );
+        ret = SetDIBitsToDevice( hdc, 1, 2, 3, 2, 1, 2, 1, 5, data, info, DIB_RGB_COLORS );
+        ok( ret == 3, "got %d\n", ret );
+        for (i = 0; i < 64; i++)
+            if (i == 36 || i == 37 || i == 38 || i == 44 || i == 45 || i == 46)
+                ok( dib_bits[i] == data[i - 27], "%d: got %08x\n", i, dib_bits[i] );
+            else
+                ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+        memset( dib_bits, 0xaa, 64 * 4 );
+        pSetLayout( hdc, LAYOUT_LTR );
+    }
+
     /* t-d -> b-u */
     info->bmiHeader.biHeight = -8;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, data, info, DIB_RGB_COLORS );
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 3630c3e..d5668e3 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -3737,6 +3737,7 @@ INT X11DRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD
     pt.x = xDest;
     pt.y = yDest;
     LPtoDP(dev->hdc, &pt, 1);
+    if (GetLayout( dev->hdc ) & LAYOUT_RTL) pt.x -= cx - 1;
 
     if (!lines || (startscan >= height)) return 0;
     if (!top_down && startscan + lines > height) lines = height - startscan;




More information about the wine-cvs mailing list