Fix webp loading decode frame bug 44/276344/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 15 Jun 2022 04:56:47 +0000 (13:56 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 15 Jun 2022 04:56:47 +0000 (13:56 +0900)
When we try to decode at the same frame, same loader
and not 0 frame, It will fail to decode.

Due to we don't hold latest preload pixel buffer,
It will think that we fail to decode the frame.

This patch make we decode current frame one more time.

Change-Id: I6ab6cd0a5929c4d7b184d0508313c6906750ab9a
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/imaging/common/webp-loading.cpp

index 61baf2a..7790c66 100644 (file)
@@ -119,7 +119,7 @@ public:
       mWebPData.bytes = mBuffer;
 
       WebPDemuxer* demuxer = WebPDemux(&mWebPData);
-      uint32_t flags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS);
+      uint32_t     flags   = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS);
       if(flags & ANIMATION_FLAG)
       {
         mIsAnimatedImage = true;
@@ -268,7 +268,7 @@ public:
   bool            mIsLocalResource;
 
 #ifdef DALI_WEBP_AVAILABLE
-  WebPData                 mWebPData{0};
+  WebPData mWebPData{0};
 #endif
 
 #ifdef DALI_ANIMATED_WEBP_ENABLED
@@ -397,7 +397,7 @@ Dali::Devel::PixelBuffer WebPLoading::DecodeFrame(uint32_t frameIndex)
 {
   Dali::Devel::PixelBuffer pixelBuffer;
 #ifdef DALI_ANIMATED_WEBP_ENABLED
-  if(mImpl->mLatestLoadedFrame > static_cast<int32_t>(frameIndex))
+  if(mImpl->mLatestLoadedFrame >= static_cast<int32_t>(frameIndex))
   {
     mImpl->mLatestLoadedFrame = INITIAL_INDEX;
     WebPAnimDecoderReset(mImpl->mWebPAnimDecoder);