mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 13:20:30 +00:00
Create GFX_CTL_SET_VIDEO_MODE
This commit is contained in:
parent
637ee33ab6
commit
5516ff05b5
@ -961,7 +961,13 @@ static void gl_set_rotation(void *data, unsigned rotation)
|
||||
static void gl_set_video_mode(void *data, unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
gfx_ctx_set_video_mode(width, height, fullscreen);
|
||||
gfx_ctx_mode_t mode;
|
||||
|
||||
mode.width = width;
|
||||
mode.height = height;
|
||||
mode.fullscreen = fullscreen;
|
||||
|
||||
gfx_ctx_ctl(GFX_CTL_SET_VIDEO_MODE, &mode);
|
||||
}
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
@ -2471,6 +2477,7 @@ static void gl_begin_debug(gl_t *gl)
|
||||
|
||||
static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
{
|
||||
gfx_ctx_mode_t mode;
|
||||
gfx_ctx_input_t inp;
|
||||
unsigned interval;
|
||||
unsigned win_width, win_height, temp_width = 0, temp_height = 0;
|
||||
@ -2507,7 +2514,11 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
win_height = gl->full_y;
|
||||
}
|
||||
|
||||
if (!gfx_ctx_set_video_mode(win_width, win_height, video->fullscreen))
|
||||
mode.width = win_width;
|
||||
mode.height = win_height;
|
||||
mode.fullscreen = video->fullscreen;
|
||||
|
||||
if (!gfx_ctx_ctl(GFX_CTL_SET_VIDEO_MODE, &mode))
|
||||
goto error;
|
||||
|
||||
/* Clear out potential error flags in case we use cached context. */
|
||||
|
@ -85,6 +85,7 @@ static INLINE bool vg_query_extension(const char *ext)
|
||||
|
||||
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
{
|
||||
gfx_ctx_mode_t mode;
|
||||
gfx_ctx_input_t inp;
|
||||
gfx_ctx_aspect_t aspect_data;
|
||||
unsigned interval;
|
||||
@ -124,7 +125,11 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
win_height = temp_height;
|
||||
}
|
||||
|
||||
if (!gfx_ctx_set_video_mode(win_width, win_height, video->fullscreen))
|
||||
mode.width = win_width;
|
||||
mode.height = win_height;
|
||||
mode.fullscreen = video->fullscreen;
|
||||
|
||||
if !(gfx_ctx_ctl(GFX_CTL_SET_VIDEO_MODE, &mode))
|
||||
goto error;
|
||||
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
|
@ -83,16 +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;
|
||||
|
||||
bool gfx_ctx_set_video_mode(
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
if (!current_video_context || !current_video_context->set_video_mode)
|
||||
return false;
|
||||
return current_video_context->set_video_mode(
|
||||
video_context_data, width, height, fullscreen);
|
||||
}
|
||||
|
||||
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
if (!current_video_context || !current_video_context->get_video_size)
|
||||
@ -432,6 +422,16 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
|
||||
ident->ident = current_video_context->ident;
|
||||
}
|
||||
break;
|
||||
case GFX_CTL_SET_VIDEO_MODE:
|
||||
{
|
||||
gfx_ctx_mode_t *mode_info = (gfx_ctx_mode_t*)data;
|
||||
if (!current_video_context || !current_video_context->set_video_mode)
|
||||
return false;
|
||||
return current_video_context->set_video_mode(
|
||||
video_context_data, mode_info->width,
|
||||
mode_info->height, mode_info->fullscreen);
|
||||
}
|
||||
break;
|
||||
case GFX_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
|
@ -79,7 +79,8 @@ enum gfx_ctx_ctl_state
|
||||
GFX_CTL_GET_METRICS,
|
||||
GFX_CTL_INPUT_DRIVER,
|
||||
GFX_CTL_SUPPRESS_SCREENSAVER,
|
||||
GFX_CTL_IDENT_GET
|
||||
GFX_CTL_IDENT_GET,
|
||||
GFX_CTL_SET_VIDEO_MODE
|
||||
};
|
||||
|
||||
typedef void (*gfx_ctx_proc_t)(void);
|
||||
@ -188,6 +189,13 @@ typedef struct gfx_ctx_size
|
||||
unsigned *height;
|
||||
} gfx_ctx_size_t;
|
||||
|
||||
typedef struct gfx_ctx_mode
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
bool fullscreen;
|
||||
} gfx_ctx_mode_t;
|
||||
|
||||
typedef struct gfx_ctx_metrics
|
||||
{
|
||||
enum display_metric_types type;
|
||||
@ -264,9 +272,6 @@ extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||
const gfx_ctx_driver_t *gfx_ctx_init_first(void *data, const char *ident,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor, bool hw_render_ctx);
|
||||
|
||||
bool gfx_ctx_set_video_mode(unsigned width, unsigned height,
|
||||
bool fullscreen);
|
||||
|
||||
void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
|
||||
|
||||
bool gfx_ctx_set_resize(unsigned width, unsigned height);
|
||||
|
@ -804,6 +804,8 @@ bool video_driver_set_rotation(unsigned rotation)
|
||||
bool video_driver_set_video_mode(unsigned width,
|
||||
unsigned height, bool fullscreen)
|
||||
{
|
||||
gfx_ctx_mode_t mode;
|
||||
|
||||
if (video_driver_poke && video_driver_poke->set_video_mode)
|
||||
{
|
||||
video_driver_poke->set_video_mode(video_driver_data,
|
||||
@ -811,7 +813,11 @@ bool video_driver_set_video_mode(unsigned width,
|
||||
return true;
|
||||
}
|
||||
|
||||
return gfx_ctx_set_video_mode(width, height, fullscreen);
|
||||
mode.width = width;
|
||||
mode.height = height;
|
||||
mode.fullscreen = fullscreen;
|
||||
|
||||
return gfx_ctx_ctl(GFX_CTL_SET_VIDEO_MODE, &mode);
|
||||
}
|
||||
|
||||
bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
|
||||
|
Loading…
x
Reference in New Issue
Block a user