From b5cf8e90c9e881ee94820b4043bd759e017a00ac Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Thu, 3 Jan 2019 18:51:00 +0100 Subject: [PATCH] Improve aspect_ratio detection in PS2 GFX (#7879) --- gfx/drivers/ps2_gfx.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/gfx/drivers/ps2_gfx.c b/gfx/drivers/ps2_gfx.c index 7ee0803c95..6770afcc40 100644 --- a/gfx/drivers/ps2_gfx.c +++ b/gfx/drivers/ps2_gfx.c @@ -153,16 +153,9 @@ static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture) { static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect) { float x1, y1, x2, y2; if (force_aspect) { - float delta = 1.0f; - float texture_aspect_ratio = texture->Width / texture->Height; - float gsGlobal_aspect_ratio = gsGlobal->Width / gsGlobal->Height; - if (texture_aspect_ratio < gsGlobal_aspect_ratio) { - //height - delta = gsGlobal->Height / texture->Height; - } else { - //width - delta = gsGlobal->Width / texture->Width; - } + float width_proportion = (float)gsGlobal->Width / (float)texture->Width; + float height_proportion = (float)gsGlobal->Height / (float)texture->Height; + float delta = MIN(width_proportion, height_proportion); float newWidth = texture->Width * delta; float newHeight = texture->Height * delta;