From 8dc7524e43cf01c276b397bd9e3f2ecaa2e7861c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 27 Jul 2020 08:15:35 +0200 Subject: [PATCH] Get rid of video_context_driver_translate_aspect wrapper function --- gfx/drivers/gl.c | 9 +++------ gfx/drivers/gl1.c | 9 +++------ gfx/drivers/gl_core.c | 9 +++------ gfx/drivers/vg.c | 9 +++------ gfx/drivers/vulkan.c | 9 +++------ retroarch.c | 15 ++------------- retroarch.h | 2 -- 7 files changed, 17 insertions(+), 45 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 82d6c35959..58c742958f 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -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) { diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 06c4ec9bdb..04887e512c 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -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) { diff --git a/gfx/drivers/gl_core.c b/gfx/drivers/gl_core.c index e288472aa2..ac9cc39dcc 100644 --- a/gfx/drivers/gl_core.c +++ b/gfx/drivers/gl_core.c @@ -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) { diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index c4d0e4289b..6a784eb095 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -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); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 38b1ec7287..a5628ac2b3 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -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) { diff --git a/retroarch.c b/retroarch.c index db5973966d..b78f553651 100644 --- a/retroarch.c +++ b/retroarch.c @@ -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; diff --git a/retroarch.h b/retroarch.h index 9df8ffa94d..6a41e57ab0 100644 --- a/retroarch.h +++ b/retroarch.h @@ -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);