Module: wine Branch: master Commit: 039c85346c323e1145b5a5f2e5334328ac37baa9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=039c85346c323e1145b5a5f2e5...
Author: Alexandre Julliard julliard@winehq.org Date: Wed May 2 12:02:17 2012 +0200
gdiplus: CreateDIBSection doesn't need a DC for the DIB_RGB_COLORS case.
---
dlls/gdiplus/gdiplus.c | 7 +------ dlls/gdiplus/graphics.c | 8 +------- dlls/gdiplus/image.c | 19 ++----------------- 3 files changed, 4 insertions(+), 30 deletions(-)
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 @@ COLORREF ARGB2COLORREF(ARGB color)
HBITMAP ARGB2BMP(ARGB color) { - HDC hdc; BITMAPINFO bi; HBITMAP result; RGBQUAD *bits; @@ -273,8 +272,6 @@ HBITMAP ARGB2BMP(ARGB color)
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 @@ HBITMAP ARGB2BMP(ARGB color) 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 COLORREF get_gdi_brush_color(const GpBrush *brush) 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 @@ static HBITMAP create_hatch_bitmap(const GpHatch *hatch) 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 @@ static HBITMAP create_hatch_bitmap(const GpHatch *hatch) } }
- 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 WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, GpStatus stat; HBITMAP result; UINT width, height; - HDC hdc; BITMAPINFOHEADER bih; LPBYTE bits; BitmapData lockeddata; @@ -1395,11 +1394,7 @@ GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, 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 @@ GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, else stat = GenericError;
- DeleteDC(hdc); - if (stat != Ok && result) { DeleteObject(result); @@ -1694,7 +1687,6 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, 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 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, pbmi->bmiHeader.biClrUsed = 0; pbmi->bmiHeader.biClrImportant = 0;
- hdc = CreateCompatibleDC(NULL); - if (!hdc) { - GdipFree(pbmi); - return GenericError; - } - - hbitmap = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); + hbitmap = CreateDIBSection(0, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
- DeleteDC(hdc); GdipFree(pbmi);
if (!hbitmap) return GenericError;