From fed2998d48792d7811fba34603fb5c7f5f313bf8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 17 May 2014 22:32:11 -0700 Subject: [PATCH] cellPngDec: Ignore bytesPerLine < width * bpp. It seems strange, but Sonic CD passes bytesPerLine = w * 3 for a 4 channel image. Either this is a bug elsewhere, or it ignores likely incorrect strides. Untested except in Sonic CD. --- rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index a9c94dbd9c..d169321c51 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -182,7 +182,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m { const char nComponents = current_outParam.outputColorSpace == CELL_PNGDEC_RGBA ? 4 : 3; image_size *= nComponents; - if (bytesPerLine != width * nComponents || flip) //check if we need padding + if (bytesPerLine > width * nComponents || flip) //check if we need padding { const int linesize = std::min(bytesPerLine, width * nComponents); for (int i = 0; i < height; i++) @@ -203,7 +203,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m { const char nComponents = 4; image_size *= nComponents; - if (bytesPerLine != width * nComponents || flip) //check if we need padding + if (bytesPerLine > width * nComponents || flip) //check if we need padding { //TODO: find out if we can't do padding without an extra copy const int linesize = std::min(bytesPerLine, width * nComponents);