wined3d: Implement wined3d_swapchain_set_gamma_ramp() on top of wined3d_output_set_gamma_ramp().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2021-03-25 16:46:44 +01:00 committed by Alexandre Julliard
parent e27ea1e03a
commit bd9aca2cc8
3 changed files with 29 additions and 10 deletions

View File

@ -1509,6 +1509,19 @@ HRESULT CDECL wined3d_output_set_gamma_ramp(struct wined3d_output *output, const
return WINED3D_OK;
}
HRESULT wined3d_output_get_gamma_ramp(struct wined3d_output *output, struct wined3d_gamma_ramp *ramp)
{
HDC dc;
TRACE("output %p, ramp %p.\n", output, ramp);
dc = CreateDCW(output->device_name, NULL, NULL, NULL);
GetDeviceGammaRamp(dc, ramp);
DeleteDC(dc);
return WINED3D_OK;
}
HRESULT CDECL wined3d_adapter_get_identifier(const struct wined3d_adapter *adapter,
DWORD flags, struct wined3d_adapter_identifier *identifier)
{

View File

@ -363,18 +363,20 @@ void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain,
HRESULT CDECL wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
DWORD flags, const struct wined3d_gamma_ramp *ramp)
{
HDC dc;
struct wined3d_output *output;
TRACE("swapchain %p, flags %#x, ramp %p.\n", swapchain, flags, ramp);
if (flags)
FIXME("Ignoring flags %#x.\n", flags);
dc = GetDCEx(swapchain->state.device_window, 0, DCX_USESTYLE | DCX_CACHE);
SetDeviceGammaRamp(dc, (void *)ramp);
ReleaseDC(swapchain->state.device_window, dc);
if (!(output = wined3d_swapchain_get_output(swapchain)))
{
ERR("Failed to get output from swapchain %p.\n", swapchain);
return E_FAIL;
}
return WINED3D_OK;
return wined3d_output_set_gamma_ramp(output, ramp);
}
void CDECL wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, struct wined3d_palette *palette)
@ -389,15 +391,17 @@ void CDECL wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, st
HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
struct wined3d_gamma_ramp *ramp)
{
HDC dc;
struct wined3d_output *output;
TRACE("swapchain %p, ramp %p.\n", swapchain, ramp);
dc = GetDCEx(swapchain->state.device_window, 0, DCX_USESTYLE | DCX_CACHE);
GetDeviceGammaRamp(dc, ramp);
ReleaseDC(swapchain->state.device_window, dc);
if (!(output = wined3d_swapchain_get_output(swapchain)))
{
ERR("Failed to get output from swapchain %p.\n", swapchain);
return E_FAIL;
}
return WINED3D_OK;
return wined3d_output_get_gamma_ramp(output, ramp);
}
/* The is a fallback for cases where we e.g. can't create a GL context or

View File

@ -3367,6 +3367,8 @@ struct wined3d_output
D3DDDI_VIDEO_PRESENT_SOURCE_ID vidpn_source_id;
};
HRESULT wined3d_output_get_gamma_ramp(struct wined3d_output *output, struct wined3d_gamma_ramp *ramp) DECLSPEC_HIDDEN;
/* The adapter structure */
struct wined3d_adapter
{