From 4e5d39bf23dd855f7a9d81455368e4dca33c8567 Mon Sep 17 00:00:00 2001 From: Vinicius Rangel Date: Fri, 22 Nov 2024 03:43:45 -0300 Subject: [PATCH] fix stride calculation --- src/core/libraries/libpng/pngdec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/libraries/libpng/pngdec.cpp b/src/core/libraries/libpng/pngdec.cpp index 4c0027165..31f3cc7a7 100644 --- a/src/core/libraries/libpng/pngdec.cpp +++ b/src/core/libraries/libpng/pngdec.cpp @@ -171,8 +171,9 @@ s32 PS4_SYSV_ABI scePngDecDecode(OrbisPngDecHandle handle, const OrbisPngDecDeco auto ptr = (png_bytep)param->imageMemAddr; auto const numChannels = png_get_channels(pngh->png_ptr, pngh->info_ptr); + auto horizontal_bytes = numChannels * width; - int stride = param->imagePitch > 0 ? (param->imagePitch - width) : 0; + int stride = param->imagePitch > 0 ? (param->imagePitch - horizontal_bytes) : 0; for (int y = 0; y < height; y++) { for (int x = 0; x < numChannels * width; x++) { *ptr++ = row_pointers[y][x];