[PATCH 2/5] wined3d: Avoid a redundant call to EnumDisplaySettingsExW() in wined3d_enum_adapter_modes().
Henri Verbeet
hverbeet at codeweavers.com
Thu Jun 28 06:11:11 CDT 2012
---
dlls/wined3d/directx.c | 40 ++++++++++++++--------------------------
1 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 2232efd..6e85554 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2951,7 +2951,6 @@ HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT ada
const struct wined3d_format *format = wined3d_get_format(&wined3d->adapters[adapter_idx].gl_info, format_id);
UINT format_bits = format->byte_count * CHAR_BIT;
DEVMODEW DevModeW;
- int ModeIdx = 0;
UINT i = 0;
int j = 0;
@@ -2980,34 +2979,23 @@ HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT ada
}
}
- ModeIdx = j - 1;
+ mode->width = DevModeW.dmPelsWidth;
+ mode->height = DevModeW.dmPelsHeight;
+ mode->refresh_rate = DEFAULT_REFRESH_RATE;
+ if (DevModeW.dmFields & DM_DISPLAYFREQUENCY)
+ mode->refresh_rate = DevModeW.dmDisplayFrequency;
- /* Now get the display mode via the calculated index */
- if (EnumDisplaySettingsExW(NULL, ModeIdx, &DevModeW, 0))
- {
- mode->width = DevModeW.dmPelsWidth;
- mode->height = DevModeW.dmPelsHeight;
- mode->refresh_rate = DEFAULT_REFRESH_RATE;
- if (DevModeW.dmFields & DM_DISPLAYFREQUENCY)
- mode->refresh_rate = DevModeW.dmDisplayFrequency;
+ if (format_id == WINED3DFMT_UNKNOWN)
+ mode->format_id = pixelformat_for_depth(DevModeW.dmBitsPerPel);
+ else
+ mode->format_id = format_id;
- if (format_id == WINED3DFMT_UNKNOWN)
- mode->format_id = pixelformat_for_depth(DevModeW.dmBitsPerPel);
- else
- mode->format_id = format_id;
-
- if (!(DevModeW.dmFields & DM_DISPLAYFLAGS))
- mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
- else if (DevModeW.u2.dmDisplayFlags & DM_INTERLACED)
- mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_INTERLACED;
- else
- mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_PROGRESSIVE;
- }
+ if (!(DevModeW.dmFields & DM_DISPLAYFLAGS))
+ mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
+ else if (DevModeW.u2.dmDisplayFlags & DM_INTERLACED)
+ mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_INTERLACED;
else
- {
- TRACE("Requested mode %u out of range.\n", mode_idx);
- return WINED3DERR_INVALIDCALL;
- }
+ mode->scanline_ordering = WINED3D_SCANLINE_ORDERING_PROGRESSIVE;
TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode->width, mode->height, mode->refresh_rate,
DevModeW.dmBitsPerPel, debug_d3dformat(mode->format_id), mode->scanline_ordering);
--
1.7.8.6
More information about the wine-patches
mailing list