Move static local variables to gfx_ctx_ctl - and other cleanups

This commit is contained in:
twinaphex 2016-02-14 02:30:24 +01:00
parent 68969d1363
commit 9f26e3bc69
2 changed files with 9 additions and 4 deletions

View File

@ -80,8 +80,6 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
NULL
};
static const gfx_ctx_driver_t *current_video_context;
static void *video_context_data;
/**
* find_gfx_ctx_driver_index:
@ -180,7 +178,7 @@ static const gfx_ctx_driver_t *gfx_ctx_init(void *data,
ctx->bind_hw_render(ctx_data,
settings->video.shared_context && hw_render_ctx);
video_context_data = ctx_data;
gfx_ctx_ctl(GFX_CTL_SET_VIDEO_CONTEXT_DATA, ctx_data);
return ctx;
}
@ -254,6 +252,9 @@ const gfx_ctx_driver_t *gfx_ctx_init_first(void *data,
bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
{
static const gfx_ctx_driver_t *current_video_context = NULL;
static void *video_context_data = NULL;
switch (state)
{
case GFX_CTL_CHECK_WINDOW:
@ -432,6 +433,9 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
current_video_context->get_video_size(video_context_data, &mode_info->width, &mode_info->height);
}
break;
case GFX_CTL_SET_VIDEO_CONTEXT_DATA:
video_context_data = data;
break;
case GFX_CTL_NONE:
default:
break;

View File

@ -82,7 +82,8 @@ enum gfx_ctx_ctl_state
GFX_CTL_IDENT_GET,
GFX_CTL_SET_VIDEO_MODE,
GFX_CTL_SET_RESIZE,
GFX_CTL_GET_VIDEO_SIZE
GFX_CTL_GET_VIDEO_SIZE,
GFX_CTL_SET_VIDEO_CONTEXT_DATA
};
typedef void (*gfx_ctx_proc_t)(void);