Commit 27d2b9b8 authored by Wolfram Sang's avatar Wolfram Sang Committed by Alexandre Julliard

winex11.drv: In GetDIBits() with DIB sections, always use dibpitch from the target.

parent fe05a730
......@@ -1218,7 +1218,8 @@ static void test_GetDIBits_selected_DIB(UINT bpp)
BITMAPINFO * info2;
void * bits;
void * bits2;
UINT dib_size;
UINT dib_size, dib32_size;
DWORD pixel;
HDC dib_dc, dc;
HBITMAP old_bmp;
BOOL equalContents;
......@@ -1254,6 +1255,7 @@ static void test_GetDIBits_selected_DIB(UINT bpp)
dib = CreateDIBSection(NULL, info, DIB_RGB_COLORS, &bits, NULL, 0);
assert(dib);
dib_size = bpp * (info->bmiHeader.biWidth * info->bmiHeader.biHeight) / 8;
dib32_size = 32 * (info->bmiHeader.biWidth * info->bmiHeader.biHeight) / 8;
/* Set the bits of the DIB section */
for (i=0; i < dib_size; i++)
......@@ -1265,7 +1267,7 @@ static void test_GetDIBits_selected_DIB(UINT bpp)
dib_dc = CreateCompatibleDC(NULL);
old_bmp = SelectObject(dib_dc, dib);
dc = CreateCompatibleDC(NULL);
bits2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dib_size);
bits2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dib32_size);
assert(bits2);
/* Copy the DIB attributes but not the color table */
......@@ -1300,6 +1302,15 @@ static void test_GetDIBits_selected_DIB(UINT bpp)
}
ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
/* Map into a 32bit-DIB */
info2->bmiHeader.biBitCount = 32;
res = GetDIBits(dc, dib, 0, info->bmiHeader.biHeight, bits2, info2, DIB_RGB_COLORS);
ok(res, "GetDIBits failed\n");
/* Check if last pixel was set */
pixel = ((DWORD *)bits2)[info->bmiHeader.biWidth * info->bmiHeader.biHeight - 1];
ok(pixel != 0, "Pixel: 0x%08x\n", pixel);
HeapFree(GetProcessHeap(), 0, bits2);
DeleteDC(dc);
......
......@@ -4210,8 +4210,7 @@ INT CDECL X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
descr.ySrc = startscan;
}
descr.shm_mode = physBitmap->shm_mode;
descr.dibpitch = (obj_size == sizeof(DIBSECTION)) ? dib.dsBm.bmWidthBytes
: (((descr.infoWidth * descr.infoBpp + 31) &~31) / 8);
descr.dibpitch = (((descr.infoWidth * descr.infoBpp + 31) &~31) / 8);
X11DRV_DIB_Lock( physBitmap, DIB_Status_GdiMod );
X11DRV_DIB_GetImageBits( &descr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment