mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 03:10:14 +00:00
Add GFX_CTL_GET_VIDEO_SIZE
This commit is contained in:
parent
bcaf08ad2d
commit
68969d1363
@ -540,10 +540,16 @@ void d3d_make_d3dpp(void *data,
|
||||
if (!d3dpp->Windowed)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
gfx_ctx_mode_t mode;
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
|
||||
gfx_ctx_get_video_size(&width, &height);
|
||||
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode);
|
||||
|
||||
width = mode.width;
|
||||
height = mode.height;
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
video_driver_set_size(&width, &height);
|
||||
#endif
|
||||
video_driver_get_size(&d3dpp->BackBufferWidth, &d3dpp->BackBufferHeight);
|
||||
@ -1012,7 +1018,14 @@ static bool d3d_construct(d3d_video_t *d3d,
|
||||
(int)(mon_rect.right - mon_rect.left),
|
||||
(int)(mon_rect.bottom - mon_rect.top));
|
||||
#else
|
||||
gfx_ctx_get_video_size(&full_x, &full_y);
|
||||
{
|
||||
gfx_ctx_mode_t mode;
|
||||
|
||||
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode);
|
||||
|
||||
full_x = mode.width;
|
||||
full_y = mode.height;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
unsigned new_width = info->fullscreen ? full_x : info->width;
|
||||
|
@ -2503,7 +2503,13 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
|
||||
RARCH_LOG("Found GL context: %s\n", ctx_driver->ident);
|
||||
|
||||
gfx_ctx_get_video_size(&gl->full_x, &gl->full_y);
|
||||
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode);
|
||||
|
||||
gl->full_x = mode.width;
|
||||
gl->full_y = mode.height;
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
|
||||
RARCH_LOG("Detecting screen resolution %ux%u.\n", gl->full_x, gl->full_y);
|
||||
|
||||
interval = video->vsync ? settings->video.swap_interval : 0;
|
||||
@ -2555,9 +2561,18 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
|
||||
gl->vsync = video->vsync;
|
||||
gl->fullscreen = video->fullscreen;
|
||||
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
|
||||
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode);
|
||||
|
||||
temp_width = mode.width;
|
||||
temp_height = mode.height;
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
|
||||
/* Get real known video size, which might have been altered by context. */
|
||||
gfx_ctx_get_video_size(&temp_width, &temp_height);
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(&temp_width, &temp_height);
|
||||
|
@ -101,7 +101,13 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
|
||||
gfx_ctx_ctl(GFX_CTL_SET, ctx);
|
||||
|
||||
gfx_ctx_get_video_size(&temp_width, &temp_height);
|
||||
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode);
|
||||
|
||||
temp_width = mode.width;
|
||||
temp_height = mode.height;
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
|
||||
RARCH_LOG("Detecting screen resolution %ux%u.\n", temp_width, temp_height);
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
@ -136,7 +142,16 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
|
||||
temp_width = 0;
|
||||
temp_height = 0;
|
||||
gfx_ctx_get_video_size(&temp_width, &temp_height);
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
|
||||
gfx_ctx_ctl(GFX_CTL_GET_VIDEO_SIZE, &mode);
|
||||
|
||||
temp_width = mode.width;
|
||||
temp_height = mode.height;
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
|
||||
vg->should_resize = true;
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
|
@ -83,13 +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_get_video_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
if (!current_video_context || !current_video_context->get_video_size)
|
||||
return;
|
||||
current_video_context->get_video_size(video_context_data, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* find_gfx_ctx_driver_index:
|
||||
* @ident : Identifier of resampler driver to find.
|
||||
@ -431,6 +424,14 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
|
||||
return current_video_context->set_resize(
|
||||
video_context_data, mode_info->width, mode_info->height);
|
||||
}
|
||||
case GFX_CTL_GET_VIDEO_SIZE:
|
||||
{
|
||||
gfx_ctx_mode_t *mode_info = (gfx_ctx_mode_t*)data;
|
||||
if (!current_video_context || !current_video_context->get_video_size)
|
||||
return false;
|
||||
current_video_context->get_video_size(video_context_data, &mode_info->width, &mode_info->height);
|
||||
}
|
||||
break;
|
||||
case GFX_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
|
@ -81,7 +81,8 @@ enum gfx_ctx_ctl_state
|
||||
GFX_CTL_SUPPRESS_SCREENSAVER,
|
||||
GFX_CTL_IDENT_GET,
|
||||
GFX_CTL_SET_VIDEO_MODE,
|
||||
GFX_CTL_SET_RESIZE
|
||||
GFX_CTL_SET_RESIZE,
|
||||
GFX_CTL_GET_VIDEO_SIZE
|
||||
};
|
||||
|
||||
typedef void (*gfx_ctx_proc_t)(void);
|
||||
@ -273,8 +274,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);
|
||||
|
||||
void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
|
||||
|
||||
bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user