gdiplus: CreateDIBSection doesn't need a DC for the DIB_RGB_COLORS case.
diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c
index 9c3478b..56d8330 100644
--- a/dlls/gdiplus/gdiplus.c
+++ b/dlls/gdiplus/gdiplus.c
@@ -265,7 +265,6 @@
HBITMAP ARGB2BMP(ARGB color)
{
- HDC hdc;
BITMAPINFO bi;
HBITMAP result;
RGBQUAD *bits;
@@ -273,8 +272,6 @@
if ((color & 0xff000000) == 0xff000000) return 0;
- hdc = CreateCompatibleDC(NULL);
-
bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
bi.bmiHeader.biWidth = 1;
bi.bmiHeader.biHeight = 1;
@@ -287,15 +284,13 @@
bi.bmiHeader.biClrUsed = 0;
bi.bmiHeader.biClrImportant = 0;
- result = CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, (void*)&bits, NULL, 0);
+ result = CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void*)&bits, NULL, 0);
bits[0].rgbReserved = alpha = (color>>24)&0xff;
bits[0].rgbRed = ((color>>16)&0xff)*alpha/255;
bits[0].rgbGreen = ((color>>8)&0xff)*alpha/255;
bits[0].rgbBlue = (color&0xff)*alpha/255;
- DeleteDC(hdc);
-
return result;
}
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 92bc27e..a5e3eb2 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -131,15 +131,10 @@
static HBITMAP create_hatch_bitmap(const GpHatch *hatch)
{
HBITMAP hbmp;
- HDC hdc;
BITMAPINFOHEADER bmih;
DWORD *bits;
int x, y;
- hdc = CreateCompatibleDC(0);
-
- if (!hdc) return 0;
-
bmih.biSize = sizeof(bmih);
bmih.biWidth = 8;
bmih.biHeight = 8;
@@ -148,7 +143,7 @@
bmih.biCompression = BI_RGB;
bmih.biSizeImage = 0;
- hbmp = CreateDIBSection(hdc, (BITMAPINFO *)&bmih, DIB_RGB_COLORS, (void **)&bits, NULL, 0);
+ hbmp = CreateDIBSection(0, (BITMAPINFO *)&bmih, DIB_RGB_COLORS, (void **)&bits, NULL, 0);
if (hbmp)
{
const char *hatch_data;
@@ -175,7 +170,6 @@
}
}
- DeleteDC(hdc);
return hbmp;
}
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 825ca02..ba8b979 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -1372,7 +1372,6 @@
GpStatus stat;
HBITMAP result;
UINT width, height;
- HDC hdc;
BITMAPINFOHEADER bih;
LPBYTE bits;
BitmapData lockeddata;
@@ -1395,11 +1394,7 @@
bih.biClrUsed = 0;
bih.biClrImportant = 0;
- hdc = CreateCompatibleDC(NULL);
- if (!hdc) return GenericError;
-
- result = CreateDIBSection(hdc, (BITMAPINFO*)&bih, DIB_RGB_COLORS, (void**)&bits,
- NULL, 0);
+ result = CreateDIBSection(0, (BITMAPINFO*)&bih, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
if (result)
{
@@ -1415,8 +1410,6 @@
else
stat = GenericError;
- DeleteDC(hdc);
-
if (stat != Ok && result)
{
DeleteObject(result);
@@ -1694,7 +1687,6 @@
BITMAPINFO* pbmi;
HBITMAP hbitmap=NULL;
INT row_size, dib_stride;
- HDC hdc;
BYTE *bits=NULL, *own_bits=NULL;
REAL xres, yres;
GpStatus stat;
@@ -1739,15 +1731,8 @@
pbmi->bmiHeader.biClrUsed = 0;
pbmi->bmiHeader.biClrImportant = 0;
- hdc = CreateCompatibleDC(NULL);
- if (!hdc) {
- GdipFree(pbmi);
- return GenericError;
- }
+ hbitmap = CreateDIBSection(0, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
- hbitmap = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
-
- DeleteDC(hdc);
GdipFree(pbmi);
if (!hbitmap) return GenericError;