mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
Create some more gfx_ctx wrapper functions
This commit is contained in:
parent
4e24111f42
commit
82124d6181
@ -874,11 +874,7 @@ static void gl_set_rotation(void *data, unsigned rotation)
|
||||
static void gl_set_video_mode(void *data, unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||
|
||||
if (gl && ctx && ctx->set_video_mode)
|
||||
ctx->set_video_mode(gl, width, height, fullscreen);
|
||||
gfx_ctx_set_video_mode(data, width, height, fullscreen);
|
||||
}
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
@ -1669,11 +1665,11 @@ static bool gl_frame(void *data, const void *frame,
|
||||
!driver->nonblock_state && !runloop->is_slowmotion
|
||||
&& !runloop->is_paused)
|
||||
{
|
||||
ctx->swap_buffers(gl);
|
||||
gfx_ctx_swap_buffers(gl);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
ctx->swap_buffers(gl);
|
||||
gfx_ctx_swap_buffers(gl);
|
||||
|
||||
#ifdef HAVE_GL_SYNC
|
||||
if (settings->video.hard_sync && gl->have_sync)
|
||||
@ -2493,12 +2489,7 @@ static bool gl_alive(void *data)
|
||||
|
||||
static bool gl_focus(void *data)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||
|
||||
if (!gl)
|
||||
return false;
|
||||
return ctx->has_focus(gl);
|
||||
return gfx_ctx_focus(data);
|
||||
}
|
||||
|
||||
static bool gl_suppress_screensaver(void *data, bool enable)
|
||||
|
@ -73,6 +73,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
const gfx_ctx_driver_t *gfx_ctx_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
@ -81,6 +82,33 @@ const gfx_ctx_driver_t *gfx_ctx_get_ptr(void)
|
||||
return (const gfx_ctx_driver_t*)driver->video_context;
|
||||
}
|
||||
|
||||
void gfx_ctx_swap_buffers(void *data)
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||
|
||||
if (ctx->swap_buffers)
|
||||
ctx->swap_buffers(data);
|
||||
}
|
||||
|
||||
bool gfx_ctx_focus(void *data)
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||
|
||||
if (data && ctx && ctx->has_focus)
|
||||
return ctx->has_focus(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
void gfx_ctx_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||
|
||||
if (ctx && ctx->set_video_mode)
|
||||
ctx->set_video_mode(data, width, height, fullscreen);
|
||||
}
|
||||
|
||||
void gfx_ctx_translate_aspect(void *data, float *aspect,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
|
@ -207,6 +207,14 @@ bool gfx_ctx_get_metrics(enum display_metric_types type, float *value);
|
||||
void gfx_ctx_translate_aspect(void *data, float *aspect,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
void gfx_ctx_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen);
|
||||
|
||||
void gfx_ctx_swap_buffers(void *data);
|
||||
|
||||
bool gfx_ctx_focus(void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user