From e1ca5c38e2ecfc7fc941ce7c05f8a4077b57681b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 1 Sep 2011 12:41:00 +0200 Subject: [PATCH] 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(+) diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index d69e4632569..e7b7d2d7b0a 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 3630c3eb931..d5668e31cdf 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;