Add GFX_CTL_FREE

This commit is contained in:
twinaphex 2016-02-13 08:26:54 +01:00
parent 753fd86c2e
commit fab6c9b8c4
5 changed files with 11 additions and 14 deletions

View File

@ -1171,7 +1171,7 @@ static void d3d_free(void *data)
d3d_free_overlays(d3d); d3d_free_overlays(d3d);
#endif #endif
gfx_ctx_free(); gfx_ctx_ctl(GFX_CTL_FREE, NULL);
#ifndef _XBOX #ifndef _XBOX
#ifdef HAVE_MENU #ifdef HAVE_MENU

View File

@ -1994,7 +1994,7 @@ static void gl_free(void *data)
} }
#endif #endif
gfx_ctx_free(); gfx_ctx_ctl(GFX_CTL_FREE, NULL);
free(gl->empty_buf); free(gl->empty_buf);
free(gl->conv_buffer); free(gl->conv_buffer);

View File

@ -220,7 +220,7 @@ static void vg_free(void *data)
vgDestroyPaint(vg->mPaintBg); vgDestroyPaint(vg->mPaintBg);
} }
gfx_ctx_free(); gfx_ctx_ctl(GFX_CTL_FREE, NULL);
free(vg); free(vg);
} }

View File

@ -95,14 +95,6 @@ void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver)
current_video_context = NULL; current_video_context = NULL;
} }
void gfx_ctx_free(void)
{
if (current_video_context->destroy)
current_video_context->destroy(video_context_data);
current_video_context = NULL;
video_context_data = NULL;
}
const char *gfx_ctx_get_ident(void) const char *gfx_ctx_get_ident(void)
{ {
const gfx_ctx_driver_t *ctx = current_video_context; const gfx_ctx_driver_t *ctx = current_video_context;
@ -447,6 +439,12 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
{ {
switch (state) switch (state)
{ {
case GFX_CTL_FREE:
if (current_video_context->destroy)
current_video_context->destroy(video_context_data);
current_video_context = NULL;
video_context_data = NULL;
break;
case GFX_CTL_NONE: case GFX_CTL_NONE:
default: default:
break; break;

View File

@ -53,7 +53,8 @@ enum display_metric_types
enum gfx_ctx_ctl_state enum gfx_ctx_ctl_state
{ {
GFX_CTL_NONE = 0 GFX_CTL_NONE = 0,
GFX_CTL_FREE
}; };
typedef void (*gfx_ctx_proc_t)(void); typedef void (*gfx_ctx_proc_t)(void);
@ -248,8 +249,6 @@ bool gfx_ctx_get_video_output_next(void);
const char *gfx_ctx_get_ident(void); const char *gfx_ctx_get_ident(void);
void gfx_ctx_free(void);
void gfx_ctx_input_driver( void gfx_ctx_input_driver(
const input_driver_t **input, void **input_data); const input_driver_t **input, void **input_data);