Commit 356eaa1e authored by Alexander Scott-Johns's avatar Alexander Scott-Johns Committed by Alexandre Julliard

winex11.drv: Improve error handling in bitmap synthesizing code.

parent d2d4fe67
......@@ -1060,21 +1060,23 @@ static BOOL X11DRV_CLIPBOARD_RenderSynthesizedBitmap(Display *display)
if (lpSource->hData || X11DRV_CLIPBOARD_RenderFormat(display, lpSource))
{
HDC hdc;
HBITMAP hData;
HBITMAP hData = NULL;
unsigned int offset;
LPBITMAPINFOHEADER lpbmih;
hdc = GetDC(NULL);
lpbmih = GlobalLock(lpSource->hData);
if (lpbmih)
{
offset = sizeof(BITMAPINFOHEADER)
+ ((lpbmih->biBitCount <= 8) ? (sizeof(RGBQUAD) *
(1 << lpbmih->biBitCount)) : 0);
offset = sizeof(BITMAPINFOHEADER)
+ ((lpbmih->biBitCount <= 8) ? (sizeof(RGBQUAD) *
(1 << lpbmih->biBitCount)) : 0);
hData = CreateDIBitmap(hdc, lpbmih, CBM_INIT, (LPBYTE)lpbmih +
offset, (LPBITMAPINFO) lpbmih, DIB_RGB_COLORS);
hData = CreateDIBitmap(hdc, lpbmih, CBM_INIT, (LPBYTE)lpbmih +
offset, (LPBITMAPINFO) lpbmih, DIB_RGB_COLORS);
GlobalUnlock(lpSource->hData);
GlobalUnlock(lpSource->hData);
}
ReleaseDC(NULL, hdc);
if (hData)
......
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