Module: wine Branch: master Commit: 0553eba08f15a321838f34e7aac15ead64c2cb03 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0553eba08f15a321838f34e7aa...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Wed Feb 20 14:18:13 2013 +0800
gdiplus: Use an off-screen DC as an image surface.
---
dlls/gdiplus/image.c | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 9c34333..59ea41c 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -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; }