(Graphics context) Create gfx_ctx_translate_aspect

This commit is contained in:
twinaphex 2015-04-09 21:48:20 +02:00
parent a002ce6e6d
commit 4e24111f42
3 changed files with 12 additions and 3 deletions

View File

@ -776,10 +776,8 @@ void gl_set_viewport(gl_t *gl, unsigned width,
struct gl_ortho ortho = {0, 1, 0, 1, -1, 1};
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx->translate_aspect)
device_aspect = ctx->translate_aspect(gl, width, height);
gfx_ctx_translate_aspect(gl, &device_aspect, width, height);
if (settings->video.scale_integer && !force_full)
{

View File

@ -81,6 +81,14 @@ const gfx_ctx_driver_t *gfx_ctx_get_ptr(void)
return (const gfx_ctx_driver_t*)driver->video_context;
}
void gfx_ctx_translate_aspect(void *data, float *aspect,
unsigned width, unsigned height)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx && ctx->translate_aspect)
*aspect = ctx->translate_aspect(data, width, height);
}
bool gfx_ctx_get_metrics(enum display_metric_types type, float *value)
{
driver_t *driver = driver_get_ptr();

View File

@ -204,6 +204,9 @@ const gfx_ctx_driver_t *gfx_ctx_get_ptr(void);
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);
#ifdef __cplusplus
}
#endif