wined3d: Introduce wined3d_swapchain_resize_target().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-08-04 17:23:42 +02:00 committed by Alexandre Julliard
parent fb2540f8b1
commit 28f24b9ddf
3 changed files with 52 additions and 0 deletions

View File

@ -1397,6 +1397,55 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
return WINED3D_OK; return WINED3D_OK;
} }
HRESULT CDECL wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchain,
const struct wined3d_display_mode *mode)
{
struct wined3d_device *device = swapchain->device;
struct wined3d_display_mode current_mode;
RECT original_window_rect, window_rect;
HRESULT hr;
TRACE("swapchain %p, mode %p.\n", swapchain, mode);
SetRect(&window_rect, 0, 0, mode->width, mode->height);
if (swapchain->desc.windowed)
{
AdjustWindowRectEx(&window_rect,
GetWindowLongW(swapchain->device_window, GWL_STYLE), FALSE,
GetWindowLongW(swapchain->device_window, GWL_EXSTYLE));
SetRect(&window_rect, 0, 0,
window_rect.right - window_rect.left, window_rect.bottom - window_rect.top);
GetWindowRect(swapchain->device_window, &original_window_rect);
OffsetRect(&window_rect, original_window_rect.left, original_window_rect.top);
}
else if (swapchain->desc.flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
{
if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, device->adapter->ordinal, mode)))
{
WARN("Failed to set display mode, hr %#x.\n", hr);
return WINED3DERR_INVALIDCALL;
}
}
else
{
if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, device->adapter->ordinal,
&current_mode, NULL)))
{
ERR("Failed to get display mode, hr %#x.\n", hr);
return WINED3DERR_INVALIDCALL;
}
SetRect(&window_rect, 0, 0, current_mode.width, current_mode.height);
}
MoveWindow(swapchain->device_window, window_rect.left, window_rect.top,
window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top, TRUE);
return WINED3D_OK;
}
HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain, HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain,
const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode) const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode)
{ {

View File

@ -242,6 +242,7 @@
@ cdecl wined3d_swapchain_incref(ptr) @ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long) @ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long)
@ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long) @ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long)
@ cdecl wined3d_swapchain_resize_target(ptr ptr)
@ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr) @ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr)
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr) @ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
@ cdecl wined3d_swapchain_set_palette(ptr ptr) @ cdecl wined3d_swapchain_set_palette(ptr ptr)

View File

@ -2527,6 +2527,8 @@ HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
HRESULT __cdecl wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count, HRESULT __cdecl wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
unsigned int width, unsigned int height, enum wined3d_format_id format_id, unsigned int width, unsigned int height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality); enum wined3d_multisample_type multisample_type, unsigned int multisample_quality);
HRESULT __cdecl wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchain,
const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain, HRESULT __cdecl wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain,
const struct wined3d_swapchain_desc *desc, const struct wined3d_display_mode *mode); const struct wined3d_swapchain_desc *desc, const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain, HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,