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

This commit is contained in:
Alexander Scott-Johns 2011-01-31 15:38:31 +00:00 committed by Alexandre Julliard
parent d2d4fe67be
commit 356eaa1ee2
1 changed files with 10 additions and 8 deletions

View File

@ -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)