Simplify video_driver_get_ptr

This commit is contained in:
twinaphex 2015-11-20 18:50:21 +01:00
parent 9ea40f5e32
commit ddde58caf4
6 changed files with 8 additions and 12 deletions

View File

@ -54,7 +54,7 @@ static bool shader_null_set_mvp(void *data, const math_matrix_4x4 *mat)
{ {
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
#ifndef NO_GL_FF_MATRIX #ifndef NO_GL_FF_MATRIX
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL); gl_t *gl = (gl_t*)video_driver_get_ptr();
if (gl) if (gl)
{ {
gl_ff_matrix(mat); gl_ff_matrix(mat);
@ -68,7 +68,7 @@ static bool shader_null_set_coords(const void *data)
{ {
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
#ifndef NO_GL_FF_VERTEX #ifndef NO_GL_FF_VERTEX
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL); gl_t *gl = (gl_t*)video_driver_get_ptr();
if (gl) if (gl)
{ {
const struct gfx_coords *coords = (const struct gfx_coords*)data; const struct gfx_coords *coords = (const struct gfx_coords*)data;

View File

@ -203,14 +203,13 @@ static bool find_video_driver(void)
/** /**
* video_driver_get_ptr: * video_driver_get_ptr:
* @drv : real video driver will be set to this.
* *
* Use this if you need the real video driver * Use this if you need the real video driver
* and driver data pointers. * and driver data pointers.
* *
* Returns: video driver's userdata. * Returns: video driver's userdata.
**/ **/
void *video_driver_get_ptr(const video_driver_t **drv) void *video_driver_get_ptr(void)
{ {
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
@ -219,10 +218,8 @@ void *video_driver_get_ptr(const video_driver_t **drv)
if (settings->video.threaded if (settings->video.threaded
&& !video_state.hw_render_callback.context_type) && !video_state.hw_render_callback.context_type)
return rarch_threaded_video_get_ptr(drv); return rarch_threaded_video_get_ptr(NULL);
#endif #endif
if (drv)
*drv = driver->video;
return driver->video_data; return driver->video_data;
} }

View File

@ -268,14 +268,13 @@ const char* config_get_video_driver_options(void);
/** /**
* video_driver_get_ptr: * video_driver_get_ptr:
* @drv : real video driver will be set to this.
* *
* Use this if you need the real video driver * Use this if you need the real video driver
* and driver data pointers. * and driver data pointers.
* *
* Returns: video driver's userdata. * Returns: video driver's userdata.
**/ **/
void *video_driver_get_ptr(const video_driver_t **drv); void *video_driver_get_ptr(void);
/** /**
* video_driver_get_current_framebuffer: * video_driver_get_current_framebuffer:

View File

@ -45,7 +45,7 @@ static const float d3d_tex_coords[] = {
static d3d_video_t *d3d_get_ptr(void) static d3d_video_t *d3d_get_ptr(void)
{ {
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(NULL); d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr();
if (!d3d) if (!d3d)
return NULL; return NULL;

View File

@ -40,7 +40,7 @@ static const GLfloat gl_tex_coords[] = {
static gl_t *gl_get_ptr(void) static gl_t *gl_get_ptr(void)
{ {
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL); gl_t *gl = (gl_t*)video_driver_get_ptr();
if (!gl) if (!gl)
return NULL; return NULL;
return gl; return gl;

View File

@ -239,7 +239,7 @@ bool menu_display_init_main_font(void *data,
{ {
bool ret; bool ret;
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
void *video = video_driver_get_ptr(NULL); void *video = video_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr(); menu_display_t *disp = menu_display_get_ptr();
if (!disp) if (!disp)