Create GFX_CTX_GET_VIDEO_OUTPUT_SIZE

This commit is contained in:
twinaphex 2016-02-13 19:36:02 +01:00
parent 46d210e977
commit b9a5c326cd
3 changed files with 23 additions and 11 deletions

View File

@ -3399,7 +3399,10 @@ static struct video_shader *gl_get_current_shader(void *data)
static void gl_get_video_output_size(void *data,
unsigned *width, unsigned *height)
{
gfx_ctx_get_video_output_size(width, height);
gfx_ctx_size_t size_data;
size_data.width = width;
size_data.height = height;
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_OUTPUT_SIZE, &size_data);
}
static void gl_get_video_output_prev(void *data)

View File

@ -92,13 +92,6 @@ const char *gfx_ctx_get_ident(void)
return ctx->ident;
}
void gfx_ctx_get_video_output_size(unsigned *width, unsigned *height)
{
if (!current_video_context || !current_video_context->get_video_output_size)
return;
current_video_context->get_video_output_size(video_context_data, width, height);
}
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
bool fullscreen)
@ -427,6 +420,17 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
current_video_context = NULL;
video_context_data = NULL;
break;
case GFX_CTL_GET_VIDEO_OUTPUT_SIZE:
{
gfx_ctx_size_t *size_data = (gfx_ctx_size_t*)data;
if (!size_data)
return false;
if (!current_video_context || !current_video_context->get_video_output_size)
return false;
current_video_context->get_video_output_size(video_context_data,
size_data->width, size_data->height);
}
break;
case GFX_CTL_NONE:
default:
break;

View File

@ -69,7 +69,8 @@ enum gfx_ctx_ctl_state
/* Finds next driver in graphics context driver array. */
GFX_CTL_FIND_NEXT_DRIVER,
/* Finds previous driver in graphics context driver array. */
GFX_CTL_FIND_PREV_DRIVER
GFX_CTL_FIND_PREV_DRIVER,
GFX_CTL_GET_VIDEO_OUTPUT_SIZE
};
typedef void (*gfx_ctx_proc_t)(void);
@ -170,6 +171,12 @@ typedef struct gfx_ctx_driver
void (*bind_hw_render)(void *data, bool enable);
} gfx_ctx_driver_t;
typedef struct gfx_ctx_size
{
unsigned *width;
unsigned *height;
} gfx_ctx_size_t;
extern const gfx_ctx_driver_t gfx_ctx_sdl_gl;
extern const gfx_ctx_driver_t gfx_ctx_x_egl;
extern const gfx_ctx_driver_t gfx_ctx_wayland;
@ -229,8 +236,6 @@ bool gfx_ctx_set_resize(unsigned width, unsigned height);
void gfx_ctx_swap_interval(unsigned interval);
void gfx_ctx_get_video_output_size(unsigned *width, unsigned *height);
const char *gfx_ctx_get_ident(void);
void gfx_ctx_input_driver(