Commit 0553eba0 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdiplus: Use an off-screen DC as an image surface.

parent 97b92fe1
......@@ -116,10 +116,9 @@ static INT ipicture_pixel_height(IPicture *pic)
IPicture_get_Height(pic, &y);
hdcref = GetDC(0);
hdcref = CreateCompatibleDC(0);
y = MulDiv(y, GetDeviceCaps(hdcref, LOGPIXELSY), INCH_HIMETRIC);
ReleaseDC(0, hdcref);
DeleteDC(hdcref);
return y;
}
......@@ -131,11 +130,9 @@ static INT ipicture_pixel_width(IPicture *pic)
IPicture_get_Width(pic, &x);
hdcref = GetDC(0);
hdcref = CreateCompatibleDC(0);
x = MulDiv(x, GetDeviceCaps(hdcref, LOGPIXELSX), INCH_HIMETRIC);
ReleaseDC(0, hdcref);
DeleteDC(hdcref);
return x;
}
......@@ -1688,7 +1685,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
bih.biClrUsed = 0;
bih.biClrImportant = 0;
screendc = GetDC(0);
screendc = CreateCompatibleDC(0);
if (iinfo.hbmColor)
{
GetDIBits(screendc, iinfo.hbmColor, 0, height, lockeddata.Scan0, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
......@@ -1756,7 +1753,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
}
}
ReleaseDC(0, screendc);
DeleteDC(screendc);
DeleteObject(iinfo.hbmColor);
DeleteObject(iinfo.hbmMask);
......@@ -1806,14 +1803,14 @@ static void generate_halftone_palette(ARGB *entries, UINT count)
static GpStatus get_screen_resolution(REAL *xres, REAL *yres)
{
HDC screendc = GetDC(0);
HDC screendc = CreateCompatibleDC(0);
if (!screendc) return GenericError;
*xres = (REAL)GetDeviceCaps(screendc, LOGPIXELSX);
*yres = (REAL)GetDeviceCaps(screendc, LOGPIXELSY);
ReleaseDC(0, screendc);
DeleteDC(screendc);
return Ok;
}
......
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