Rewrite video_context_driver_set_resize

This commit is contained in:
twinaphex 2017-01-19 14:31:57 +01:00
parent b93046f867
commit 9d1de5c974
19 changed files with 21 additions and 147 deletions

View File

@ -881,7 +881,7 @@ static bool d3d_alive(void *data)
mode.width = temp_width;
mode.height = temp_height;
video_context_driver_set_resize(&mode);
video_context_driver_set_resize(mode);
d3d_restore(d3d);
}

View File

@ -1143,7 +1143,7 @@ static bool gl_frame(void *data, const void *frame,
mode.width = width;
mode.height = height;
video_context_driver_set_resize(&mode);
video_context_driver_set_resize(mode);
#ifdef HAVE_FBO
if (gl->fbo_inited)

View File

@ -1921,7 +1921,7 @@ static bool vulkan_frame(void *data, const void *frame,
gfx_ctx_mode_t mode;
mode.width = width;
mode.height = height;
video_context_driver_set_resize(&mode);
video_context_driver_set_resize(mode);
vk->should_resize = false;
}

View File

@ -100,14 +100,6 @@ static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t *video_info)
CGLFlushDrawable(cgl->glCtx);
}
static bool gfx_ctx_cgl_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool gfx_ctx_cgl_set_video_mode(void *data,
video_frame_info_t *video_info,
unsigned width, unsigned height,
@ -344,7 +336,7 @@ const gfx_ctx_driver_t gfx_ctx_cgl = {
NULL,
NULL, /* update_title */
gfx_ctx_cgl_check_window,
gfx_ctx_cgl_set_resize,
NULL, /* set_resize */
gfx_ctx_cgl_has_focus,
gfx_ctx_cgl_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -574,14 +574,6 @@ static void cocoagl_gfx_ctx_check_window(void *data, bool *quit,
}
}
static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void cocoagl_gfx_ctx_input_driver(void *data,
const char *name,
const input_driver_t **input, void **input_data)
@ -631,7 +623,7 @@ const gfx_ctx_driver_t gfx_ctx_cocoagl = {
NULL, /* update_title */
#endif
cocoagl_gfx_ctx_check_window,
cocoagl_gfx_ctx_set_resize,
NULL, /* set_resize */
cocoagl_gfx_ctx_has_focus,
cocoagl_gfx_ctx_suppress_screensaver,
#if defined(HAVE_COCOATOUCH)

View File

@ -258,16 +258,6 @@ static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t *video_info)
gfx_ctx_drm_wait_flip(true);
}
static bool gfx_ctx_drm_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_drm_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -869,7 +859,7 @@ const gfx_ctx_driver_t gfx_ctx_drm = {
NULL,
NULL, /* update_window_title */
gfx_ctx_drm_check_window,
gfx_ctx_drm_set_resize,
NULL, /* set_resize */
gfx_ctx_drm_has_focus,
gfx_ctx_drm_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -80,15 +80,6 @@ static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t *vide
/* no-op in emscripten, no way to force swap/wait for VSync in browsers */
}
static bool gfx_ctx_emscripten_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_emscripten_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -318,7 +309,7 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = {
gfx_ctx_emscripten_translate_aspect,
NULL, /* update_title */
gfx_ctx_emscripten_check_window,
gfx_ctx_emscripten_set_resize,
NULL, /* set_resize */
gfx_ctx_emscripten_has_focus,
gfx_ctx_emscripten_suppress_screensaver,
gfx_ctx_emscripten_has_windowed,

View File

@ -39,14 +39,6 @@ static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t *video_info
(void)data;
}
static bool gfx_ctx_null_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
@ -150,7 +142,7 @@ const gfx_ctx_driver_t gfx_ctx_null = {
NULL,
NULL, /* update_title */
gfx_ctx_null_check_window,
gfx_ctx_null_set_resize,
NULL, /* set_resize */
gfx_ctx_null_has_focus,
gfx_ctx_null_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -147,15 +147,6 @@ static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_mali_fbdev_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
video_frame_info_t *video_info,
unsigned width, unsigned height,
@ -300,7 +291,7 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
NULL,
NULL, /* update_title */
gfx_ctx_mali_fbdev_check_window,
gfx_ctx_mali_fbdev_set_resize,
NULL, /* set_resize */
gfx_ctx_mali_fbdev_has_focus,
gfx_ctx_mali_fbdev_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -131,15 +131,6 @@ static void gfx_ctx_opendingux_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_opendingux_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool gfx_ctx_opendingux_set_video_mode(void *data,
video_frame_info_t *video_info,
unsigned width, unsigned height,
@ -274,7 +265,7 @@ const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev = {
NULL,
NULL, /* update_title */
gfx_ctx_opendingux_check_window,
gfx_ctx_opendingux_set_resize,
NULL, /* set_resize */
gfx_ctx_opendingux_has_focus,
gfx_ctx_opendingux_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -317,14 +317,6 @@ static void osmesa_ctx_check_window(void *data, bool *quit,
*quit = false;
}
static bool osmesa_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool osmesa_ctx_has_focus(void *data)
{
(void)data;
@ -402,7 +394,7 @@ const gfx_ctx_driver_t gfx_ctx_osmesa =
NULL, /* translate_aspect */
NULL, /* update_title */
osmesa_ctx_check_window,
osmesa_ctx_set_resize,
NULL, /* set_resize */
osmesa_ctx_has_focus,
osmesa_ctx_suppress_screensaver,
osmesa_ctx_has_windowed,

View File

@ -186,12 +186,6 @@ static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t *video_info)
#endif
}
static bool gfx_ctx_ps3_set_resize(void *data,
unsigned width, unsigned height)
{
return false;
}
static void gfx_ctx_ps3_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -413,7 +407,7 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
NULL,
NULL, /* update_title */
gfx_ctx_ps3_check_window,
gfx_ctx_ps3_set_resize,
NULL, /* set_resize */
gfx_ctx_ps3_has_focus,
gfx_ctx_ps3_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -307,15 +307,6 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
*quit = true;
}
static bool gfx_ctx_qnx_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool gfx_ctx_qnx_set_video_mode(void *data,
video_frame_info_t *video_info,
unsigned width, unsigned height,
@ -473,7 +464,7 @@ const gfx_ctx_driver_t gfx_ctx_qnx = {
NULL,
NULL, /* update_title */
gfx_ctx_qnx_check_window,
gfx_ctx_qnx_set_resize,
NULL, /* set_resize */
gfx_ctx_qnx_has_focus,
gfx_ctx_qnx_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -339,14 +339,6 @@ static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *
}
}
static bool sdl_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool sdl_ctx_has_focus(void *data)
{
unsigned flags;
@ -432,7 +424,7 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl =
NULL, /* translate_aspect */
sdl_ctx_update_title,
sdl_ctx_check_window,
sdl_ctx_set_resize,
NULL, /* set_resize */
sdl_ctx_has_focus,
sdl_ctx_suppress_screensaver,
sdl_ctx_has_windowed,

View File

@ -96,14 +96,6 @@ static void gfx_ctx_vc_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_vc_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -641,7 +633,7 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
gfx_ctx_vc_translate_aspect,
NULL, /* update_title */
gfx_ctx_vc_check_window,
gfx_ctx_vc_set_resize,
NULL, /* set_resize */
gfx_ctx_vc_has_focus,
gfx_ctx_vc_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -135,15 +135,6 @@ static void gfx_ctx_vivante_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_vivante_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool gfx_ctx_vivante_set_video_mode(void *data,
video_frame_info_t *video_info,
unsigned width, unsigned height,
@ -279,7 +270,7 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
NULL,
NULL, /* update_title */
gfx_ctx_vivante_check_window,
gfx_ctx_vivante_set_resize,
NULL, /* set_resize */
gfx_ctx_vivante_has_focus,
gfx_ctx_vivante_suppress_screensaver,
NULL, /* has_windowed */

View File

@ -91,15 +91,6 @@ EGL_BLUE_SIZE, 1, \
EGL_ALPHA_SIZE, 0, \
EGL_DEPTH_SIZE, 0
static bool gfx_ctx_xegl_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void *gfx_ctx_xegl_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_EGL
@ -593,7 +584,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl =
NULL,
x11_update_title,
x11_check_window,
gfx_ctx_xegl_set_resize,
NULL, /* set_resize */
x11_has_focus,
gfx_ctx_xegl_suppress_screensaver,
gfx_ctx_xegl_has_windowed,

View File

@ -462,16 +462,6 @@ bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info)
return true;
}
bool video_context_driver_set_resize(gfx_ctx_mode_t *mode_info)
{
if (!current_video_context)
return false;
if (!current_video_context->set_resize(
video_context_data, mode_info->width, mode_info->height))
return false;
return true;
}
bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info)
{
if (!current_video_context || !current_video_context->get_video_size)

View File

@ -302,6 +302,10 @@ void video_context_driver_destroy(void);
#define video_context_driver_focus() ((video_context_data && current_video_context->has_focus && current_video_context->has_focus(video_context_data)) ? true : false)
#define video_context_driver_set_resize(mode_info) \
if (current_video_context && current_video_context->set_resize) \
current_video_context->set_resize(video_context_data, mode_info.width, mode_info.height)
bool video_context_driver_get_video_output_size(gfx_ctx_size_t *size_data);
bool video_context_driver_swap_interval(unsigned *interval);
@ -314,8 +318,6 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident);
bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info);
bool video_context_driver_set_resize(gfx_ctx_mode_t *mode_info);
bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info);
bool video_context_driver_get_context_data(void *data);