From 93ba7c6449b523ce6bbe996eb3b00a540a7e7882 Mon Sep 17 00:00:00 2001 From: Daryl Borth Date: Tue, 16 Mar 2021 19:41:30 -0600 Subject: [PATCH] change max dimensions back to 640x480, fix bug in png loading --- source/menu.cpp | 4 ++-- source/utils/pngu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/menu.cpp b/source/menu.cpp index cbeb0e0..4be35d4 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1023,7 +1023,7 @@ static int MenuGameSelection() GuiImage preview; preview.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); preview.SetPosition(174, -8); - u8* imgBuffer = MEM_ALLOC(640 * 512 * 4); + u8* imgBuffer = MEM_ALLOC(640 * 480 * 4); int previousBrowserIndex = -1; char imagePath[MAXJOLIET + 1]; @@ -1114,7 +1114,7 @@ static int MenuGameSelection() snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], getImageFolder(), browserList[browser.selIndex].displayname); int width, height; - if(DecodePNGFromFile(imagePath, &width, &height, imgBuffer, 640, 512)) + if(DecodePNGFromFile(imagePath, &width, &height, imgBuffer, 640, 480)) { preview.SetImage(imgBuffer, width, height); preview.SetScale( MIN(225.0f / width, 235.0f / height) ); diff --git a/source/utils/pngu.c b/source/utils/pngu.c index a447b7d..b43ee8e 100644 --- a/source/utils/pngu.c +++ b/source/utils/pngu.c @@ -643,7 +643,7 @@ u8 * DecodePNGFromFile(const char *filepath, int * width, int * height, u8 *dstP PNGUPROP imgProp; u8 *dst = NULL; - if(PNGU_GetImageProperties(ctx, &imgProp) == PNGU_OK && imgProp.imgWidth <= maxwidth && imgProp.imgHeight < maxheight) + if(PNGU_GetImageProperties(ctx, &imgProp) == PNGU_OK && imgProp.imgWidth <= maxwidth && imgProp.imgHeight <= maxheight) dst = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, width, height, dstPtr, maxwidth, maxheight); PNGU_ReleaseImageContext (ctx);