From ef6ef131435f489344838de504702eaa2cb147db Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 13 Feb 2016 18:47:38 +0100 Subject: [PATCH] Add GFX_CTL_GET_VIDEO_OUTPUT_PREV/GFX_CTL_GET_VIDEO_OUTPUT_NEXT --- gfx/drivers/gl.c | 4 ++-- gfx/video_context_driver.c | 30 ++++++++++++------------------ gfx/video_context_driver.h | 8 +++----- gfx/video_driver.c | 20 ++++++++------------ 4 files changed, 25 insertions(+), 37 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index ce3f7e81ba..6687b61a0b 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -3404,12 +3404,12 @@ static void gl_get_video_output_size(void *data, static void gl_get_video_output_prev(void *data) { - gfx_ctx_get_video_output_prev(); + gfx_ctx_ctl(GFX_CTL_GET_VIDEO_OUTPUT_PREV, NULL); } static void gl_get_video_output_next(void *data) { - gfx_ctx_get_video_output_next(); + gfx_ctx_ctl(GFX_CTL_GET_VIDEO_OUTPUT_NEXT, NULL); } void gl_load_texture_data(uint32_t id_data, diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 026606e9f4..471c58b115 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -100,24 +100,6 @@ void gfx_ctx_get_video_output_size(unsigned *width, unsigned *height) current_video_context->get_video_output_size(video_context_data, width, height); } -bool gfx_ctx_get_video_output_prev(void) -{ - if (!current_video_context - || !current_video_context->get_video_output_prev) - return false; - current_video_context->get_video_output_prev(video_context_data); - return true; -} - -bool gfx_ctx_get_video_output_next(void) -{ - if (!current_video_context || - !current_video_context->get_video_output_next) - return false; - current_video_context->get_video_output_next(video_context_data); - return true; -} - bool gfx_ctx_set_video_mode( unsigned width, unsigned height, bool fullscreen) @@ -387,6 +369,18 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data) { switch (state) { + case GFX_CTL_GET_VIDEO_OUTPUT_PREV: + if (!current_video_context + || !current_video_context->get_video_output_prev) + return false; + current_video_context->get_video_output_prev(video_context_data); + break; + case GFX_CTL_GET_VIDEO_OUTPUT_NEXT: + if (!current_video_context || + !current_video_context->get_video_output_next) + return false; + current_video_context->get_video_output_next(video_context_data); + break; case GFX_CTL_BIND_HW_RENDER: { bool *enable = (bool*)data; diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index bafc429bfc..726a33dace 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -62,7 +62,9 @@ enum gfx_ctx_ctl_state GFX_CTL_UPDATE_WINDOW_TITLE, GFX_CTL_SHOW_MOUSE, GFX_CTL_SET, - GFX_CTL_BIND_HW_RENDER + GFX_CTL_BIND_HW_RENDER, + GFX_CTL_GET_VIDEO_OUTPUT_PREV, + GFX_CTL_GET_VIDEO_OUTPUT_NEXT }; typedef void (*gfx_ctx_proc_t)(void); @@ -239,10 +241,6 @@ void gfx_ctx_swap_interval(unsigned interval); void gfx_ctx_get_video_output_size(unsigned *width, unsigned *height); -bool gfx_ctx_get_video_output_prev(void); - -bool gfx_ctx_get_video_output_next(void); - const char *gfx_ctx_get_ident(void); void gfx_ctx_input_driver( diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 80723dd07b..153c45b03e 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1492,22 +1492,18 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data) if (!video_driver_poke) return false; - if (video_driver_poke->get_video_output_next) - { - video_driver_poke->get_video_output_next(video_driver_data); - return true; - } - return gfx_ctx_get_video_output_next(); + if (!video_driver_poke->get_video_output_next) + return gfx_ctx_ctl(GFX_CTL_GET_VIDEO_OUTPUT_NEXT, NULL); + video_driver_poke->get_video_output_next(video_driver_data); + break; case RARCH_DISPLAY_CTL_GET_PREV_VIDEO_OUT: if (!video_driver_poke) return false; - if (video_driver_poke->get_video_output_prev) - { - video_driver_poke->get_video_output_prev(video_driver_data); - return true; - } - return gfx_ctx_get_video_output_next(); + if (!video_driver_poke->get_video_output_prev) + return gfx_ctx_ctl(GFX_CTL_GET_VIDEO_OUTPUT_NEXT, NULL); + video_driver_poke->get_video_output_prev(video_driver_data); + break; case RARCH_DISPLAY_CTL_INIT: return init_video(); case RARCH_DISPLAY_CTL_DESTROY_DATA: