Enable resolution changes for D3D8 applications.

This commit is contained in:
Alex Pasadyn 2003-09-16 20:24:49 +00:00 committed by Alexandre Julliard
parent a19b6aaeb2
commit ad22804e28
1 changed files with 18 additions and 56 deletions

View File

@ -26,8 +26,8 @@
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winuser.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
@ -44,39 +44,6 @@ enum x11drv_escape_codes
X11DRV_GET_FONT, /* get current X font for a DC */ X11DRV_GET_FONT, /* get current X font for a DC */
}; };
#define NUM_MODES 20
static const int modes[NUM_MODES][4] = {
{640, 480, 85, 16},
{640, 480, 85, 32},
{800, 600, 85, 16},
{800, 600, 85, 32},
{1024, 768, 85, 16},
{1024, 768, 85, 32},
{1152, 864, 85, 16},
{1152, 864, 85, 32},
{1280, 768, 85, 16},
{1280, 768, 85, 32},
{1280, 960, 85, 16},
{1280, 960, 85, 32},
{1280, 1024, 85, 16},
{1280, 1024, 85, 32},
{1600, 900, 85, 16},
{1600, 900, 85, 32},
{1600, 1024, 85, 16},
{1600, 1024, 85, 32},
{1600, 1200, 85, 16},
{1600, 1200, 85, 32}
};
#define NUM_FORMATS 7 #define NUM_FORMATS 7
static const D3DFORMAT device_formats[NUM_FORMATS] = { static const D3DFORMAT device_formats[NUM_FORMATS] = {
D3DFMT_P8, D3DFMT_P8,
@ -189,18 +156,14 @@ UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,
} }
if (Adapter == 0) { /* Display */ if (Adapter == 0) { /* Display */
int maxWidth = GetSystemMetrics(SM_CXSCREEN); DEVMODEW DevModeW;
int maxHeight = GetSystemMetrics(SM_CYSCREEN); int i = 0;
int i;
for (i = 0; i < NUM_MODES; i++) { while (EnumDisplaySettingsExW(NULL, i, &DevModeW, 0)) {
if (modes[i][0] > maxWidth || modes[i][1] > maxHeight) { TRACE("(%p}->(Adapter: %d) => %d\n", This, Adapter, i);
TRACE("(%p}->(Adapter: %d) => %d\n", This, Adapter, i + 1); i++;
return i + 1;
}
} }
TRACE("(%p}->(Adapter: %d) => %d\n", This, Adapter, NUM_MODES); return i;
return NUM_MODES + 1;
} else { } else {
FIXME("Adapter not primary display\n"); FIXME("Adapter not primary display\n");
} }
@ -221,18 +184,17 @@ HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface,
if (Adapter == 0) { /* Display */ if (Adapter == 0) { /* Display */
HDC hdc; HDC hdc;
int bpp = 0; int bpp = 0;
DEVMODEW DevModeW;
if (Mode == 0) { if (EnumDisplaySettingsExW(NULL, Mode, &DevModeW, 0))
pMode->Width = GetSystemMetrics(SM_CXSCREEN); {
pMode->Height = GetSystemMetrics(SM_CYSCREEN); pMode->Width = DevModeW.dmPelsWidth;
pMode->RefreshRate = 85; /*FIXME: How to identify? */ pMode->Height = DevModeW.dmPelsHeight;
bpp = 32; pMode->RefreshRate = D3DADAPTER_DEFAULT;
} else if (Mode < (NUM_MODES + 1)) { bpp = DevModeW.dmBitsPerPel;
pMode->Width = modes[Mode - 1][0]; }
pMode->Height = modes[Mode - 1][1]; else
pMode->RefreshRate = modes[Mode - 1][2]; {
bpp = modes[Mode - 1][3];
} else {
TRACE("Requested mode out of range %d\n", Mode); TRACE("Requested mode out of range %d\n", Mode);
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
} }
@ -1044,7 +1006,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
/* If not windowed, need to go fullscreen, and resize the HWND to the appropriate */ /* If not windowed, need to go fullscreen, and resize the HWND to the appropriate */
/* dimensions */ /* dimensions */
if (!pPresentationParameters->Windowed) { if (!pPresentationParameters->Windowed) {
#if 0 #if 1
DEVMODEW devmode; DEVMODEW devmode;
HDC hdc; HDC hdc;
int bpp = 0; int bpp = 0;