all repos — mgba @ d481bd29fed68f15a827a71f0ca23b9b45947738

mGBA Game Boy Advance Emulator

OpenGL: Fix aspect ratio calculation for gles2
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Feb 2016 20:08:18 -0800
commit

d481bd29fed68f15a827a71f0ca23b9b45947738

parent

d8ad87504d300af1e5a61affb4ae340f58e29cc9

1 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/platform/opengl/gles2.csrc/platform/opengl/gles2.c

@@ -156,10 +156,10 @@ static void GBAGLES2ContextResized(struct VideoBackend* v, unsigned w, unsigned h) {

unsigned drawW = w; unsigned drawH = h; if (v->lockAspectRatio) { - if (w * 2 > h * 3) { - drawW = h * 3 / 2; - } else if (w * 2 < h * 3) { - drawH = w * 2 / 3; + if (w * v->height > h * v->width) { + drawW = h * v->width / v->height; + } else if (w * v->height < h * v->width) { + drawH = w * v->height / v->width; } } glViewport(0, 0, v->width, v->height);