Divorce video_context_data from driver_t

This commit is contained in:
twinaphex 2015-11-23 21:09:40 +01:00
parent f98cda3c33
commit 0520a1b3c7
2 changed files with 9 additions and 15 deletions

View File

@ -209,7 +209,6 @@ typedef struct driver
const struct font_renderer *font_osd_driver;
void *font_osd_data;
void *video_context_data;
void *video_shader_data;
void *input_data;
void *hid_data;

View File

@ -78,29 +78,25 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
NULL
};
static void *video_context_data;
void *gfx_ctx_data_get_ptr(void)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return NULL;
return driver->video_context_data;
return video_context_data;
}
void gfx_ctx_data_set(void *ptr)
{
driver_t *driver = driver_get_ptr();
if (!driver || !ptr)
if (!ptr)
return;
driver->video_context_data = ptr;
video_context_data = ptr;
}
void gfx_ctx_free_data(void)
{
driver_t *driver = driver_get_ptr();
if (driver->video_context_data)
free(driver->video_context_data);
driver->video_context_data = NULL;
if (video_context_data)
free(video_context_data);
video_context_data = NULL;
}
static const gfx_ctx_driver_t *gfx_ctx_get_ptr(void)
@ -218,13 +214,12 @@ void gfx_ctx_translate_aspect(void *data, float *aspect,
bool gfx_ctx_get_metrics(enum display_metric_types type, float *value)
{
driver_t *driver = driver_get_ptr();
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (!ctx || !driver)
if (!ctx)
return false;
if (!ctx->get_metrics)
return false;
return ctx->get_metrics(driver->video_context_data, type,
return ctx->get_metrics(video_context_data, type,
value);
}