X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=platform-abstractions%2Ftizen%2Fimage-loaders%2Floader-jpeg-turbo.cpp;h=455d1f7d8c437647fc3a9044fc0ef5ca21569383;hb=9db595439053cf73c08ca1980dfd0145a61e6f1d;hp=d4322a61ebcb8a254a2a81f7429f1659295ad45e;hpb=d96247d2bcba33c68ec23ccb56bb88913e37a6ae;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/platform-abstractions/tizen/image-loaders/loader-jpeg-turbo.cpp b/platform-abstractions/tizen/image-loaders/loader-jpeg-turbo.cpp index d4322a6..455d1f7 100755 --- a/platform-abstractions/tizen/image-loaders/loader-jpeg-turbo.cpp +++ b/platform-abstractions/tizen/image-loaders/loader-jpeg-turbo.cpp @@ -93,6 +93,21 @@ namespace /* Stop libjpeg from printing to stderr - Do Nothing */ } + /** + * LibJPEG Turbo tjDecompress2 API doesn't distinguish between errors that still allow + * the JPEG to be displayed and fatal errors. + */ + bool IsJpegErrorFatal( const std::string& errorMessage ) + { + if( ( errorMessage.find("Corrupt JPEG data") != std::string::npos ) || + ( errorMessage.find("Invalid SOS parameters") != std::string::npos ) ) + { + return false; + } + return true; + } + + /** Simple struct to ensure xif data is deleted. */ struct ExifAutoPtr { @@ -334,7 +349,7 @@ bool LoadBitmapFromJpeg( const ResourceLoadingClient& client, const ImageLoader: { std::string errorString = tjGetErrorStr(); - if( errorString.find("Corrupt JPEG data") == std::string::npos ) + if( IsJpegErrorFatal( errorString ) ) { DALI_LOG_ERROR("%s\n", errorString.c_str()); return false; @@ -343,10 +358,6 @@ bool LoadBitmapFromJpeg( const ResourceLoadingClient& client, const ImageLoader: { DALI_LOG_WARNING("%s\n", errorString.c_str()); } - - //TurboJPEG API functions will now return an error code if a warning is triggered in the underlying libjpeg API. - //So, we need to distinguish return of tjGetErrorStr() is warning or error. - //If the return string has 'Corrupt JPEG data' prefix, it means warning. } const unsigned int bufferWidth = GetTextureDimension( scaledPreXformWidth );