Commit 28f24b9d authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Introduce wined3d_swapchain_resize_target().

parent fb2540f8
......@@ -1397,6 +1397,55 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
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,
const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode)
{
......
......@@ -242,6 +242,7 @@
@ cdecl wined3d_swapchain_incref(ptr)
@ 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_target(ptr ptr)
@ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr)
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
@ cdecl wined3d_swapchain_set_palette(ptr ptr)
......
......@@ -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,
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
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,
const struct wined3d_swapchain_desc *desc, const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
......
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