Andrew Nguyen : dxdiagn: Extract the fallback display information code to a separate function.
Alexandre Julliard
julliard at winehq.org
Wed Jun 15 13:43:00 CDT 2011
Module: wine
Branch: master
Commit: f750cf33062415fae38660a674acc833bf054ff7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f750cf33062415fae38660a674acc833bf054ff7
Author: Andrew Nguyen <anguyen at codeweavers.com>
Date: Wed Jun 15 07:10:58 2011 -0500
dxdiagn: Extract the fallback display information code to a separate function.
---
dlls/dxdiagn/provider.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 9cfa483..26a6916 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -897,7 +897,7 @@ cleanup:
return hr;
}
-static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
+static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container *node)
{
static const WCHAR szAdapterID[] = {'0',0};
@@ -910,11 +910,6 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
DWORD tmp;
WCHAR buffer[256];
- /* Try to use Direct3D to obtain the required information first. */
- hr = fill_display_information_d3d(node);
- if (hr != E_FAIL)
- return hr;
-
display_adapter = allocate_information_node(szAdapterID);
if (!display_adapter)
return E_OUTOFMEMORY;
@@ -933,8 +928,8 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
return hr;
}
- /* For now, silently ignore a failure from DirectDrawCreateEx. */
- hr = DirectDrawCreateEx(NULL, (LPVOID *)&pDirectDraw, &IID_IDirectDraw7, NULL);
+ /* Silently ignore a failure from DirectDrawCreateEx. */
+ hr = DirectDrawCreateEx(NULL, (void **)&pDirectDraw, &IID_IDirectDraw7, NULL);
if (FAILED(hr))
return S_OK;
@@ -945,7 +940,7 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
{
static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0};
- snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, ((float)tmp) / 1000000.0);
+ snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, tmp / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr))
@@ -1010,6 +1005,18 @@ cleanup:
return hr;
}
+static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
+{
+ HRESULT hr;
+
+ /* Try to use Direct3D to obtain the required information first. */
+ hr = fill_display_information_d3d(node);
+ if (hr != E_FAIL)
+ return hr;
+
+ return fill_display_information_fallback(node);
+}
+
static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
{
static const WCHAR DxDiag_SoundDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
More information about the wine-cvs
mailing list