Commit 656fc938 authored by Alexandre Julliard's avatar Alexandre Julliard

Use GetDC instead of CreateDC where possible.

parent d44ed08d
......@@ -4823,7 +4823,6 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam)
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 CREATESTRUCTW *lpcs)
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 CREATESTRUCTW *lpcs)
DeleteObject(hbm);
DeleteDC(hdc);
DeleteDC(hdcScreen);
ReleaseDC(0, hdcScreen);
infoPtr->stateImageWidth = 16;
infoPtr->stateImageHeight = 16;
......
......@@ -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);
......
......@@ -1440,9 +1440,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
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));
......
......@@ -2439,9 +2439,9 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
/* 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:
......
......@@ -1370,7 +1370,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
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(IWineD3DSurface *iface, HDC *pHDC) {
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");
......
......@@ -489,9 +489,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *if
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;
......
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