Commit 23259ce5 authored by Stephane Lussier's avatar Stephane Lussier Committed by Alexandre Julliard

In CreateDIBSection function, if hdc is NULL it now uses the desktop DC

instead of failing.
parent a319a978
......@@ -866,7 +866,17 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, BITMAPINFO *bmi, UINT16 usage,
DWORD offset)
{
HBITMAP16 hbitmap;
DC *dc = (DC *) GDI_GetObjPtr(hdc, DC_MAGIC);
DC *dc;
BOOL bDesktopDC = FALSE;
/* If the reference hdc is null, take the desktop dc */
if (hdc == 0)
{
hdc = CreateCompatibleDC(0);
bDesktopDC = TRUE;
}
dc = (DC *) GDI_GetObjPtr(hdc, DC_MAGIC);
if(!dc) dc = (DC *) GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if(!dc) return (HBITMAP16) NULL;
......@@ -874,6 +884,9 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, BITMAPINFO *bmi, UINT16 usage,
GDI_HEAP_UNLOCK(hdc);
if (bDesktopDC)
DeleteDC(hdc);
return hbitmap;
}
......@@ -885,7 +898,17 @@ HBITMAP DIB_CreateDIBSection(HDC hdc, BITMAPINFO *bmi, UINT usage,
DWORD offset, DWORD ovr_pitch)
{
HBITMAP hbitmap;
DC *dc = (DC *) GDI_GetObjPtr(hdc, DC_MAGIC);
DC *dc;
BOOL bDesktopDC = FALSE;
/* If the reference hdc is null, take the desktop dc */
if (hdc == 0)
{
hdc = CreateCompatibleDC(0);
bDesktopDC = TRUE;
}
dc = (DC *) GDI_GetObjPtr(hdc, DC_MAGIC);
if(!dc) dc = (DC *) GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if(!dc) return (HBITMAP) NULL;
......@@ -893,6 +916,9 @@ HBITMAP DIB_CreateDIBSection(HDC hdc, BITMAPINFO *bmi, UINT usage,
GDI_HEAP_UNLOCK(hdc);
if (bDesktopDC)
DeleteDC(hdc);
return hbitmap;
}
......
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