From: xinyan.mei Date: Fri, 11 Aug 2017 09:37:29 +0000 (+0800) Subject: Try to fix png crash issue X-Git-Tag: dali_1.2.53~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=bcd24b0b7e1f1347051d2c52f9698c63f47dcc41;hp=a8308df8fd7f284619007926d1115e1542c355b6 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 --- 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