Duplicate aspect ratio code that was being ran twice

This commit is contained in:
twinaphex 2019-08-12 12:52:40 +02:00
parent 6a4207fe55
commit a45c9b6eb4
20 changed files with 42 additions and 399 deletions

View File

@ -1067,30 +1067,10 @@ static void ctr_set_aspect_ratio(void* data, unsigned aspect_ratio_idx)
{
ctr_video_t *ctr = (ctr_video_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
if(!ctr)
return;
ctr->keep_aspect = true;
ctr->keep_aspect = true;
ctr->should_resize = true;
}

View File

@ -1078,27 +1078,6 @@ static void d3d8_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
d3d8_video_t *d3d = (d3d8_video_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!d3d)
return;

View File

@ -1095,27 +1095,6 @@ static void d3d9_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
d3d9_video_t *d3d = (d3d9_video_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!d3d)
return;

View File

@ -586,36 +586,6 @@ static bool dispmanx_gfx_set_shader(void *data,
return false;
}
static void dispmanx_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
{
/* Due to RetroArch setting the data pointer to NULL internally
* on core change, data is going to be NULL here after we load
* a new core from the GUI, so we can't count on accessing it
* to store the aspect ratio we are going to use, so we tell RA
* to keep track of the new aspect ratio and we get it in gfx_frame()
* with video_driver_get_aspect_ratio() to find out if it has changed. */
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
}
static uint32_t dispmanx_get_flags(void *data)
{
uint32_t flags = 0;
@ -635,7 +605,7 @@ static const video_poke_interface_t dispmanx_poke_interface = {
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
dispmanx_set_aspect_ratio,
NULL, /* set_aspect_ratio */
NULL, /* dispmanx_apply_state_changes */
dispmanx_set_texture_frame,
dispmanx_set_texture_enable,

View File

@ -1408,25 +1408,9 @@ static void exynos_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
struct exynos_video *vid = (struct exynos_video*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
if (!vid)
return;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
vid->aspect_changed = true;
}

View File

@ -4379,31 +4379,10 @@ static void gl2_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
gl_t *gl = (gl_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!gl)
return;
gl->keep_aspect = true;
gl->keep_aspect = true;
gl->should_resize = true;
}

View File

@ -1275,31 +1275,10 @@ static void gl1_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
gl1_t *gl1 = (gl1_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!gl1)
return;
gl1->keep_aspect = true;
gl1->keep_aspect = true;
gl1->should_resize = true;
}

View File

@ -1771,31 +1771,10 @@ static void gl_core_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
gl_core_t *gl = (gl_core_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!gl)
return;
gl->keep_aspect = true;
gl->keep_aspect = true;
gl->should_resize = true;
}

View File

@ -173,26 +173,6 @@ static void wiiu_gfx_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
wiiu_video_t *wiiu = (wiiu_video_t *)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
if (!wiiu)
return;

View File

@ -562,31 +562,10 @@ static void gx_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
gx_video_t *gx = (gx_video_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!gx)
return;
gx->keep_aspect = true;
gx->keep_aspect = true;
gx->should_resize = true;
}

View File

@ -244,27 +244,6 @@ static void metal_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
MetalDriver *md = (__bridge MetalDriver *)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
md.keepAspect = YES;
[md setNeedsResize];
}

View File

@ -391,16 +391,6 @@ static void ps2_set_filtering(void *data, unsigned index, bool smooth)
ps2->menu_filter = smooth ? GS_FILTER_LINEAR : GS_FILTER_NEAREST;
}
static void ps2_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
ps2_video_t *ps2 = (ps2_video_t*)data;
}
static void ps2_apply_state_changes(void *data)
{
ps2_video_t *ps2 = (ps2_video_t*)data;
}
static void ps2_set_texture_frame(void *data, const void *frame, bool rgb32,
unsigned width, unsigned height, float alpha)
{
@ -458,8 +448,8 @@ static const video_poke_interface_t ps2_poke_interface = {
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
ps2_set_aspect_ratio,
ps2_apply_state_changes,
NULL, /* set_aspect_ratio */
NULL, /* apply_state_changes */
ps2_set_texture_frame,
ps2_set_texture_enable,
ps2_set_osd_msg, /* set_osd_msg */

View File

@ -790,27 +790,10 @@ static void psp_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
psp1_video_t *psp = (psp1_video_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
if (!psp)
return;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
psp->keep_aspect = true;
psp->keep_aspect = true;
psp->should_resize = true;
}

View File

@ -642,32 +642,12 @@ static void sdl2_poke_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
sdl2_video_t *vid = (sdl2_video_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
/* FIXME: Why is vid NULL here when starting content? */
if (vid)
{
vid->video.force_aspect = true;
vid->should_resize = true;
}
if (!vid)
return;
vid->video.force_aspect = true;
vid->should_resize = true;
}
static void sdl2_poke_apply_state_changes(void *data)

View File

@ -442,29 +442,6 @@ static void sdl_set_filtering(void *data, unsigned index, bool smooth)
vid->scaler.scaler_type = smooth ? SCALER_TYPE_BILINEAR : SCALER_TYPE_POINT;
}
static void sdl_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
}
static void sdl_apply_state_changes(void *data)
{
(void)data;
@ -539,7 +516,7 @@ static const video_poke_interface_t sdl_poke_interface = {
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
sdl_set_aspect_ratio,
NULL,
sdl_apply_state_changes,
sdl_set_texture_frame,
sdl_set_texture_enable,

View File

@ -916,7 +916,7 @@ static void sunxi_set_texture_frame(void *data, const void *frame, bool rgb32,
}
}
static void sunxi_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
static void sunxi_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
float new_aspect = aspectratio_lut[aspect_ratio_idx].value;

View File

@ -319,46 +319,35 @@ static void switch_update_viewport(switch_video_t *sw,
static void switch_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
switch_video_t *sw = (switch_video_t *)data;
settings_t *settings = config_get_ptr();
switch_video_t *sw = (switch_video_t *)data;
if (!sw)
return;
sw->keep_aspect = true;
sw->o_size = false;
settings_t *settings = config_get_ptr();
sw->keep_aspect = true;
sw->o_size = false;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
sw->o_size = true;
sw->keep_aspect = false;
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
sw->o_size = true;
sw->keep_aspect = false;
break;
case ASPECT_RATIO_CUSTOM:
if (settings->bools.video_scale_integer)
{
video_driver_set_viewport_core();
sw->o_size = true;
sw->keep_aspect = false;
}
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
case ASPECT_RATIO_CUSTOM:
if (settings->bools.video_scale_integer)
{
video_driver_set_viewport_core();
sw->o_size = true;
sw->keep_aspect = false;
}
break;
default:
break;
default:
break;
}
video_driver_set_aspect_ratio_value(aspectratio_lut[aspect_ratio_idx].value);
sw->should_resize = true;
}

View File

@ -582,27 +582,6 @@ static void vita_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
vita_video_t *vita = (vita_video_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!vita)
return;
vita->keep_aspect = true;

View File

@ -2127,31 +2127,10 @@ static void vulkan_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
vk_t *vk = (vk_t*)data;
switch (aspect_ratio_idx)
{
case ASPECT_RATIO_SQUARE:
video_driver_set_viewport_square_pixel();
break;
case ASPECT_RATIO_CORE:
video_driver_set_viewport_core();
break;
case ASPECT_RATIO_CONFIG:
video_driver_set_viewport_config();
break;
default:
break;
}
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!vk)
return;
vk->keep_aspect = true;
vk->keep_aspect = true;
vk->should_resize = true;
}

View File

@ -17492,10 +17492,9 @@ void video_driver_set_aspect_ratio(void)
video_driver_set_aspect_ratio_value(
aspectratio_lut[aspect_ratio_idx].value);
if (!video_driver_poke || !video_driver_poke->set_aspect_ratio)
return;
video_driver_poke->set_aspect_ratio(
video_driver_data, aspect_ratio_idx);
if (video_driver_poke && video_driver_poke->set_aspect_ratio)
video_driver_poke->set_aspect_ratio(
video_driver_data, aspect_ratio_idx);
}
void video_driver_update_viewport(