From bcd24b0b7e1f1347051d2c52f9698c63f47dcc41 Mon Sep 17 00:00:00 2001 From: "xinyan.mei" Date: Fri, 11 Aug 2017 17:37:29 +0800 Subject: [PATCH 1/1] Try to fix png crash issue Problem: png crash Reason: png header info indicate that color type is RGB width = 92, height = 92. but real rowbytes is 92 x 4, it means the color type should be RGBA Solution: Correct the pixelformat according to the real rowbytes Change-Id: I90f2865b54c62da6fdb41f32abe3971e274b6e94 Signed-off-by: xinyan.mei --- platform-abstractions/tizen/image-loaders/loader-png.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) mode change 100644 => 100755 platform-abstractions/tizen/image-loaders/loader-png.cpp diff --git a/platform-abstractions/tizen/image-loaders/loader-png.cpp b/platform-abstractions/tizen/image-loaders/loader-png.cpp old mode 100644 new mode 100755 index e6fdcde..89bca77 --- a/platform-abstractions/tizen/image-loaders/loader-png.cpp +++ b/platform-abstractions/tizen/image-loaders/loader-png.cpp @@ -299,7 +299,20 @@ bool LoadBitmapFromPng( const ImageLoader::Input& input, Integration::Bitmap& bi if( rowBytes > stride ) { stride = GetTextureDimension(rowBytes); - bufferWidth = stride / bpp; + + bpp = stride / bufferWidth; + switch(bpp) + { + case 3: + pixelFormat = Pixel::RGB888; + break; + case 4: + pixelFormat = Pixel::RGBA8888; + break; + default: + break; + } + } // decode the whole image into bitmap buffer -- 2.7.4