Alexandre Julliard : Use GetDC instead of CreateDC where possible.
Module: wine Branch: master Commit: 656fc938154ecbb3e1f13b7523d148f51a8feb78 URL: http://source.winehq.org/git/wine.git/?a=commit;h=656fc938154ecbb3e1f13b7523... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jan 2 17:16:36 2007 +0100 Use GetDC instead of CreateDC where possible. --- dlls/comctl32/treeview.c | 5 ++--- dlls/ddraw/main.c | 4 ++-- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/directx.c | 4 ++-- dlls/wined3d/surface.c | 4 ++-- dlls/wined3d/swapchain.c | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index ff23a57..aefce78 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -4823,7 +4823,6 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoP static LRESULT TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) { - static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' }; RECT rcClient; TREEVIEW_INFO *infoPtr; LOGFONTW lf; @@ -4931,7 +4930,7 @@ TREEVIEW_Create(HWND hwnd, const CREATES infoPtr->himlState = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0); - hdcScreen = CreateDCW(szDisplayW, NULL, NULL, NULL); + hdcScreen = GetDC(0); /* Create a coloured bitmap compatible with the screen depth because checkboxes are not black&white */ @@ -4959,7 +4958,7 @@ TREEVIEW_Create(HWND hwnd, const CREATES DeleteObject(hbm); DeleteDC(hdc); - DeleteDC(hdcScreen); + ReleaseDC(0, hdcScreen); infoPtr->stateImageWidth = 16; infoPtr->stateImageHeight = 16; diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 26aac5d..c754036 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -164,9 +164,9 @@ DDRAW_Create(GUID *guid, This->ImplType = DefaultSurfaceType; /* Get the current screen settings */ - hDC = CreateDCA("DISPLAY", NULL, NULL, NULL); + hDC = GetDC(0); This->orig_bpp = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES); - DeleteDC(hDC); + ReleaseDC(0, hDC); This->orig_width = GetSystemMetrics(SM_CXSCREEN); This->orig_height = GetSystemMetrics(SM_CYSCREEN); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 58f512d..64335e7 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1440,9 +1440,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl RECT clip_rc; /* Get info on the current display setup */ - hdc = CreateDCA("DISPLAY", NULL, NULL, NULL); + hdc = GetDC(0); bpp = GetDeviceCaps(hdc, BITSPIXEL); - DeleteDC(hdc); + ReleaseDC(0, hdc); /* Change the display settings */ memset(&devmode, 0, sizeof(DEVMODEW)); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 9b1e5c2..fb76de5 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2439,9 +2439,9 @@ static HRESULT WINAPI IWineD3DImpl_Crea /* Get the initial screen setup for ddraw */ object->ddraw_width = GetSystemMetrics(SM_CXSCREEN); object->ddraw_height = GetSystemMetrics(SM_CYSCREEN); - hDC = CreateDCA("DISPLAY", NULL, NULL, NULL); + hDC = GetDC(0); object->ddraw_format = pixelformat_for_depth(GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES)); - DeleteDC(hDC); + ReleaseDC(0, hDC); return WINED3D_OK; create_device_error: diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b3799da..031d320 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1370,7 +1370,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC break; } - ddc = CreateDCA("DISPLAY", NULL, NULL, NULL); + ddc = GetDC(0); if (ddc == 0) { HeapFree(GetProcessHeap(), 0, b_info); return HRESULT_FROM_WIN32(GetLastError()); @@ -1378,7 +1378,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC TRACE("Creating a DIB section with size %dx%dx%d, size=%d\n", b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight, b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage); This->dib.DIBsection = CreateDIBSection(ddc, b_info, usage, &This->dib.bitmap_data, 0 /* Handle */, 0 /* Offset */); - DeleteDC(ddc); + ReleaseDC(0, ddc); if (!This->dib.DIBsection) { ERR("CreateDIBSection failed!\n"); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 784db56..6183718 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -489,9 +489,9 @@ static HRESULT WINAPI IWineD3DSwapChainI pMode->Height = GetSystemMetrics(SM_CYSCREEN); pMode->RefreshRate = 85; /* FIXME: How to identify? */ - hdc = CreateDCA("DISPLAY", NULL, NULL, NULL); + hdc = GetDC(0); bpp = GetDeviceCaps(hdc, BITSPIXEL); - DeleteDC(hdc); + ReleaseDC(0, hdc); switch (bpp) { case 8: pMode->Format = WINED3DFMT_R8G8B8; break;
participants (1)
-
Alexandre Julliard