Create gfx_ctx_get_video_size

This commit is contained in:
twinaphex 2015-04-10 07:12:15 +02:00
parent 901662caad
commit 93cbdebd37
5 changed files with 17 additions and 9 deletions

View File

@ -485,8 +485,7 @@ static bool d3d_construct(d3d_video_t *d3d,
(int)(mon_rect.right - mon_rect.left),
(int)(mon_rect.bottom - mon_rect.top));
#else
if (ctx && ctx->get_video_size)
ctx->get_video_size(d3d, &full_x, &full_y);
gfx_ctx_get_video_size(d3d, &full_x, &full_y);
#endif
d3d->screen_width = info->fullscreen ? full_x : info->width;
d3d->screen_height = info->fullscreen ? full_y : info->height;

View File

@ -2242,7 +2242,7 @@ 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);
ctx_driver->get_video_size(gl, &gl->full_x, &gl->full_y);
gfx_ctx_get_video_size(gl, &gl->full_x, &gl->full_y);
RARCH_LOG("Detecting screen resolution %ux%u.\n", gl->full_x, gl->full_y);
ctx_driver->swap_interval(gl,
@ -2288,7 +2288,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
gl->fullscreen = video->fullscreen;
/* Get real known video size, which might have been altered by context. */
ctx_driver->get_video_size(gl, &gl->win_width, &gl->win_height);
gfx_ctx_get_video_size(gl, &gl->win_width, &gl->win_height);
RARCH_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
if (gl->full_x || gl->full_y)

View File

@ -103,7 +103,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
driver->video_context = ctx;
ctx->get_video_size(vg, &vg->mScreenWidth, &vg->mScreenHeight);
gfx_ctx_get_video_size(vg, &vg->mScreenWidth, &vg->mScreenHeight);
RARCH_LOG("Detecting screen resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight);
ctx->swap_interval(vg, video->vsync ? 1 : 0);
@ -123,7 +123,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
if (!ctx->set_video_mode(vg, win_width, win_height, video->fullscreen))
goto error;
ctx->get_video_size(vg, &vg->mScreenWidth, &vg->mScreenHeight);
gfx_ctx_get_video_size(vg, &vg->mScreenWidth, &vg->mScreenHeight);
RARCH_LOG("Verified window resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight);
vg->should_resize = true;

View File

@ -186,6 +186,15 @@ bool gfx_ctx_suppress_screensaver(void *data, bool enable)
return false;
}
void gfx_ctx_get_video_size(void *data,
unsigned *width, unsigned *height)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx)
ctx->get_video_size(data, width, height);
}
/**
* find_gfx_ctx_driver_index:
* @ident : Identifier of resampler driver to find.

View File

@ -110,9 +110,7 @@ typedef struct gfx_ctx_driver
bool (*has_focus)(void*);
/* Should the screensaver be suppressed? */
bool (*suppress_screensaver)(void *data, bool enable);
/* Checks if context driver has windowed support. */
bool (*suppress_screensaver)(void *data, bool enable); /* Checks if context driver has windowed support. */
bool (*has_windowed)(void*);
/* Swaps buffers. VBlank sync depends on
@ -226,6 +224,8 @@ bool gfx_ctx_check_window(void *data, bool *quit, bool *resize,
bool gfx_ctx_suppress_screensaver(void *data, bool enable);
void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height);
retro_proc_address_t gfx_ctx_get_proc_address(const char *sym);
#ifdef __cplusplus