mirror of https://github.com/encounter/SDL.git
Mir: Add gamma support set/get. Still need one more function to complete the set
This commit is contained in:
parent
a729c4f97a
commit
89c538a4e3
|
@ -115,6 +115,10 @@ SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, s
|
|||
SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode))
|
||||
SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode))
|
||||
SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode))
|
||||
SDL_MIR_SYM(MirOutputGammaSupported,mir_output_is_gamma_supported,(MirOutput const* output))
|
||||
SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output))
|
||||
SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size))
|
||||
SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size))
|
||||
|
||||
SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name)
|
||||
SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name)
|
||||
|
|
|
@ -179,13 +179,13 @@ MIR_CreateDevice(int device_index)
|
|||
device->SetWindowMaximumSize = MIR_SetWindowMaximumSize;
|
||||
device->SetWindowTitle = MIR_SetWindowTitle;
|
||||
device->SetWindowGrab = MIR_SetWindowGrab;
|
||||
device->SetWindowGammaRamp = MIR_SetWindowGammaRamp;
|
||||
device->GetWindowGammaRamp = MIR_GetWindowGammaRamp;
|
||||
|
||||
device->CreateWindowFrom = NULL;
|
||||
device->SetWindowIcon = NULL;
|
||||
device->RaiseWindow = NULL;
|
||||
device->SetWindowBordered = NULL;
|
||||
device->SetWindowGammaRamp = NULL;
|
||||
device->GetWindowGammaRamp = NULL;
|
||||
device->OnWindowEnter = NULL;
|
||||
device->SetWindowPosition = NULL;
|
||||
|
||||
|
|
|
@ -376,7 +376,45 @@ MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed)
|
|||
|
||||
MIR_mir_surface_apply_spec(mir_window->surface, spec);
|
||||
MIR_mir_surface_spec_release(spec);
|
||||
}
|
||||
|
||||
int
|
||||
MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp)
|
||||
{
|
||||
MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
|
||||
Uint32 ramp_size = 256;
|
||||
|
||||
// FIXME Need to apply the changes to the output, once that public API function is around
|
||||
if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
|
||||
MIR_mir_output_set_gamma(output,
|
||||
ramp + ramp_size * 0,
|
||||
ramp + ramp_size * 1,
|
||||
ramp + ramp_size * 2,
|
||||
ramp_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp)
|
||||
{
|
||||
MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
|
||||
Uint32 ramp_size = 256;
|
||||
|
||||
if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
|
||||
if (MIR_mir_output_get_gamma_size(output) == ramp_size) {
|
||||
MIR_mir_output_get_gamma(output,
|
||||
ramp + ramp_size * 0,
|
||||
ramp + ramp_size * 1,
|
||||
ramp + ramp_size * 2,
|
||||
ramp_size);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_MIR */
|
||||
|
|
|
@ -81,6 +81,11 @@ MIR_SetWindowTitle(_THIS, SDL_Window* window);
|
|||
extern void
|
||||
MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed);
|
||||
|
||||
extern int
|
||||
MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp);
|
||||
|
||||
extern int
|
||||
MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp);
|
||||
|
||||
#endif /* _SDL_mirwindow_h */
|
||||
|
||||
|
|
Loading…
Reference in New Issue