Get rid of video_context_driver_translate_aspect wrapper function

This commit is contained in:
twinaphex 2020-07-27 08:15:35 +02:00
parent 9db00e4143
commit 8dc7524e43
7 changed files with 17 additions and 45 deletions

View File

@ -386,18 +386,15 @@ static void gl2_set_viewport(gl_t *gl,
unsigned viewport_height,
bool force_full, bool allow_rotate)
{
gfx_ctx_aspect_t aspect_data;
settings_t *settings = config_get_ptr();
unsigned height = gl->video_height;
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
video_context_driver_translate_aspect(&aspect_data);
if (gl->ctx_driver->translate_aspect)
device_aspect = gl->ctx_driver->translate_aspect(
gl->ctx_data, viewport_width, viewport_height);
if (settings->bools.video_scale_integer && !force_full)
{

View File

@ -453,18 +453,15 @@ void gl1_gfx_set_viewport(gl1_t *gl1,
unsigned viewport_height,
bool force_full, bool allow_rotate)
{
gfx_ctx_aspect_t aspect_data;
settings_t *settings = config_get_ptr();
unsigned height = gl1->video_height;
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
video_context_driver_translate_aspect(&aspect_data);
if (gl1->ctx_driver->translate_aspect)
device_aspect = gl1->ctx_driver->translate_aspect(
gl1->ctx_data, viewport_width, viewport_height);
if (settings->bools.video_scale_integer && !force_full)
{

View File

@ -767,7 +767,6 @@ static void gl_core_set_viewport(gl_core_t *gl,
unsigned viewport_height,
bool force_full, bool allow_rotate)
{
gfx_ctx_aspect_t aspect_data;
unsigned height = gl->video_height;
int x = 0;
int y = 0;
@ -776,11 +775,9 @@ static void gl_core_set_viewport(gl_core_t *gl,
bool video_scale_integer = settings->bools.video_scale_integer;
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
video_context_driver_translate_aspect(&aspect_data);
if (gl->ctx_driver->translate_aspect)
device_aspect = gl->ctx_driver->translate_aspect(
gl->ctx_data, viewport_width, viewport_height);
if (video_scale_integer && !force_full)
{

View File

@ -110,7 +110,6 @@ static void *vg_init(const video_info_t *video,
{
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp;
gfx_ctx_aspect_t aspect_data;
unsigned win_width, win_height;
VGfloat clearColor[4] = {0, 0, 0, 1};
int interval = 0;
@ -208,11 +207,9 @@ static void *vg_init(const video_info_t *video,
vg->mScreenAspect = (float)temp_width / temp_height;
aspect_data.aspect = &vg->mScreenAspect;
aspect_data.width = temp_width;
aspect_data.height = temp_height;
video_context_driver_translate_aspect(&aspect_data);
if (vg->ctx_driver->translate_aspect)
vg->mScreenAspect = vg->ctx_driver->translate_aspect(
vg->ctx_data, temp_width, temp_height);
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);

View File

@ -1470,7 +1470,6 @@ static void vulkan_set_video_mode(void *data,
static void vulkan_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
{
gfx_ctx_aspect_t aspect_data;
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
@ -1482,11 +1481,9 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
unsigned width = vk->video_width;
unsigned height = vk->video_height;
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
video_context_driver_translate_aspect(&aspect_data);
if (vk->ctx_driver->translate_aspect)
device_aspect = vk->ctx_driver->translate_aspect(
vk->ctx_data, viewport_width, viewport_height);
if (video_scale_integer && !force_full)
{

View File

@ -33328,14 +33328,12 @@ const gfx_ctx_driver_t *video_context_driver_init_first(void *data,
bool video_context_driver_write_to_image_buffer(gfx_ctx_image_t *img)
{
struct rarch_state *p_rarch = &rarch_st;
if (
return (
p_rarch->current_video_context.image_buffer_write
&& p_rarch->current_video_context.image_buffer_write(
p_rarch->video_context_data,
img->frame, img->width, img->height, img->pitch,
img->rgb32, img->index, img->handle))
return true;
return false;
img->rgb32, img->index, img->handle));
}
bool video_context_driver_get_video_output_prev(void)
@ -33358,15 +33356,6 @@ bool video_context_driver_get_video_output_next(void)
return true;
}
void video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect)
{
struct rarch_state *p_rarch = &rarch_st;
if (!p_rarch->video_context_data || !aspect || !p_rarch->current_video_context.translate_aspect)
return;
*aspect->aspect = p_rarch->current_video_context.translate_aspect(
p_rarch->video_context_data, aspect->width, aspect->height);
}
void video_context_driver_free(void)
{
struct rarch_state *p_rarch = &rarch_st;

View File

@ -1788,8 +1788,6 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags);
bool video_context_driver_get_metrics(gfx_ctx_metrics_t *metrics);
void video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect);
bool video_context_driver_input_driver(gfx_ctx_input_t *inp);
enum gfx_ctx_api video_context_driver_get_api(void);