From 8721c857e98695d429bbee315f7b32a5ac108385 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 13 Feb 2016 18:27:05 +0100 Subject: [PATCH] Add GFX_CTL_SET --- gfx/d3d/d3d.cpp | 2 +- gfx/drivers/gl.c | 2 +- gfx/drivers/vg.c | 2 +- gfx/video_context_driver.c | 11 +++++------ gfx/video_context_driver.h | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 564b89255a..343b968fb5 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1121,7 +1121,7 @@ static void *d3d_init(const video_info_t *info, #endif #endif - gfx_ctx_set(ctx_driver); + gfx_ctx_ctl(GFX_CTL_SET, ctx_driver); if (!d3d_construct(d3d, info, input, input_data)) { diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 1226f1b4fb..77c85979d6 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2464,7 +2464,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo if (!gl || !ctx_driver) goto error; - gfx_ctx_set(ctx_driver); + gfx_ctx_ctl(GFX_CTL_SET, ctx_driver); gl->video_info = *video; diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 53afcd42dc..0f51a96840 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -94,7 +94,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo if (!vg || !ctx) goto error; - gfx_ctx_set(ctx); + gfx_ctx_ctl(GFX_CTL_SET, ctx); gfx_ctx_get_video_size(&temp_width, &temp_height); RARCH_LOG("Detecting screen resolution %ux%u.\n", temp_width, temp_height); diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 3ed06b08e9..69980b88d2 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -83,12 +83,6 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { static const gfx_ctx_driver_t *current_video_context; static void *video_context_data; -void gfx_ctx_set(const gfx_ctx_driver_t *ctx_driver) -{ - if (!ctx_driver) - return; - current_video_context = ctx_driver; -} const char *gfx_ctx_get_ident(void) { @@ -407,6 +401,11 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data) { switch (state) { + case GFX_CTL_SET: + if (!data) + return false; + current_video_context = (const gfx_ctx_driver_t*)data; + break; case GFX_CTL_DESTROY: current_video_context = NULL; break; diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index dc2e16ad85..325080de1c 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -60,7 +60,8 @@ enum gfx_ctx_ctl_state GFX_CTL_SWAP_BUFFERS, GFX_CTL_HAS_WINDOWED, GFX_CTL_UPDATE_WINDOW_TITLE, - GFX_CTL_SHOW_MOUSE + GFX_CTL_SHOW_MOUSE, + GFX_CTL_SET }; typedef void (*gfx_ctx_proc_t)(void); @@ -250,8 +251,6 @@ void gfx_ctx_input_driver( retro_proc_address_t gfx_ctx_get_proc_address(const char *sym); -void gfx_ctx_set(const gfx_ctx_driver_t *ctx_driver); - bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data); #ifdef __cplusplus