Make PremultiplyOnLoad flag in image-cache class 10/284710/4
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 24 Nov 2022 05:44:25 +0000 (14:44 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 2 Dec 2022 06:04:26 +0000 (15:04 +0900)
Since this flag exist only rolling-animated-image-cache,
If we replace ImageView's visual which premultiply applied before,
It will show strange result.

Change-Id: Ic38d741581ef7265259f402f5847b99f0ba3feca
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp
dali-toolkit/internal/visuals/animated-image/animated-image-visual.h
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h
dali-toolkit/internal/visuals/animated-image/image-cache.cpp
dali-toolkit/internal/visuals/animated-image/image-cache.h
dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.h

index 3e8387f..e1ec6cf 100644 (file)
@@ -198,7 +198,7 @@ void AnimatedImageVisual::CreateImageCache()
 
   if(mAnimatedImageLoading)
   {
-    mImageCache = new RollingAnimatedImageCache(textureManager, mDesiredSize, mFittingMode, mSamplingMode, mAnimatedImageLoading, mMaskingData, *this, mCacheSize, mBatchSize, mWrapModeU, mWrapModeV, IsSynchronousLoadingRequired(), mFactoryCache.GetPreMultiplyOnLoad());
+    mImageCache = new RollingAnimatedImageCache(textureManager, mDesiredSize, mFittingMode, mSamplingMode, mAnimatedImageLoading, mMaskingData, *this, mCacheSize, mBatchSize, mWrapModeU, mWrapModeV, IsSynchronousLoadingRequired(), IsPreMultipliedAlphaEnabled());
   }
   else if(mImageUrls)
   {
@@ -209,11 +209,11 @@ void AnimatedImageVisual::CreateImageCache()
     uint16_t cacheSize = std::max(std::min(std::max(batchSize, mCacheSize), numUrls), MINIMUM_CACHESIZE);
     if(cacheSize < numUrls)
     {
-      mImageCache = new RollingImageCache(textureManager, mDesiredSize, mFittingMode, mSamplingMode, *mImageUrls, mMaskingData, *this, cacheSize, batchSize, mFrameDelay);
+      mImageCache = new RollingImageCache(textureManager, mDesiredSize, mFittingMode, mSamplingMode, *mImageUrls, mMaskingData, *this, cacheSize, batchSize, mFrameDelay, IsPreMultipliedAlphaEnabled());
     }
     else
     {
-      mImageCache = new FixedImageCache(textureManager, mDesiredSize, mFittingMode, mSamplingMode, *mImageUrls, mMaskingData, *this, batchSize, mFrameDelay);
+      mImageCache = new FixedImageCache(textureManager, mDesiredSize, mFittingMode, mSamplingMode, *mImageUrls, mMaskingData, *this, batchSize, mFrameDelay, IsPreMultipliedAlphaEnabled());
     }
   }
 
@@ -940,8 +940,10 @@ void AnimatedImageVisual::SetImageSize(TextureSet& textureSet)
   }
 }
 
-void AnimatedImageVisual::FrameReady(TextureSet textureSet, uint32_t interval)
+void AnimatedImageVisual::FrameReady(TextureSet textureSet, uint32_t interval, bool preMultiplied)
 {
+  EnablePreMultipliedAlpha(preMultiplied);
+
   // When image visual requested to load new frame to mImageCache and it is failed.
   if(!mImageCache || !textureSet)
   {
index 243b989..84113a1 100644 (file)
@@ -228,8 +228,9 @@ private:
    * @brief Called when the next frame is ready.
    * @param[in] textureSet the texture set to apply
    * @param[in] interval interval(ms) for the frame
+   * @param[in] preMultiplied whether the texture is premultied alpha or not.
    */
-  void FrameReady(TextureSet textureSet, uint32_t interval) override;
+  void FrameReady(TextureSet textureSet, uint32_t interval, bool preMultiplied) override;
 
   /**
    * @brief Display the next frame. It is called when the mFrameDelayTimer ticks.
index c40f802..854a7a0 100644 (file)
@@ -43,8 +43,9 @@ FixedImageCache::FixedImageCache(TextureManager&                     textureMana
                                  TextureManager::MaskingDataPointer& maskingData,
                                  ImageCache::FrameReadyObserver&     observer,
                                  uint32_t                            batchSize,
-                                 uint32_t                            interval)
-: ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, interval),
+                                 uint32_t                            interval,
+                                 bool                                preMultiplyOnLoad)
+: ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, interval, preMultiplyOnLoad),
   mImageUrls(urlList),
   mFront(FIRST_FRAME_INDEX)
 {
@@ -133,9 +134,11 @@ void FixedImageCache::LoadBatch()
     ImageAtlasManagerPtr  imageAtlasManager  = nullptr;
     Vector4               textureRect;
     Dali::ImageDimensions textureRectSize;
-    auto                  preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
 
-    mTextureManager.LoadTexture(url, mDesiredSize, mFittingMode, mSamplingMode, mMaskingData, synchronousLoading, mImageUrls[frameIndex].mTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply);
+    auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
+                                                   : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+
+    mTextureManager.LoadTexture(url, mDesiredSize, mFittingMode, mSamplingMode, mMaskingData, synchronousLoading, mImageUrls[frameIndex].mTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiplyOnLoading);
     mRequestingLoad = false;
   }
 }
@@ -152,11 +155,11 @@ TextureSet FixedImageCache::GetFrontTextureSet() const
   return textureSet;
 }
 
-void FixedImageCache::CheckFrontFrame(bool wasReady)
+void FixedImageCache::CheckFrontFrame(bool wasReady, bool preMultiplied)
 {
   if(wasReady == false && IsFrontReady())
   {
-    mObserver.FrameReady(GetFrontTextureSet(), mInterval);
+    mObserver.FrameReady(GetFrontTextureSet(), mInterval, preMultiplied);
   }
 }
 
@@ -199,12 +202,13 @@ void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureI
     {
       mReadyFlags.back() = true;
     }
-    CheckFrontFrame(frontFrameReady);
+    CheckFrontFrame(frontFrameReady, textureInformation.preMultiplied);
   }
   else
   {
     mLoadState = TextureManager::LoadState::LOAD_FAILED;
-    mObserver.FrameReady(TextureSet(), 0);
+    // preMultiplied should be false because broken image don't premultiply alpha on load
+    mObserver.FrameReady(TextureSet(), 0, false);
   }
 }
 
index 90e2c8f..7cbfa63 100644 (file)
@@ -32,15 +32,16 @@ class FixedImageCache : public ImageCache, public TextureUploadObserver
 public:
   /**
    * Constructor.
-   * @param[in] textureManager The texture manager
-   * @param[in] size           The width and height to fit the loaded image to.
-   * @param[in] fittingMode    The FittingMode of the resource to load
-   * @param[in] samplingMode   The SamplingMode of the resource to load
-   * @param[in] urlList        List of urls to cache
-   * @param[in] maskingData    Masking data to be applied.
-   * @param[in] observer       FrameReady observer
-   * @param[in] batchSize      The size of a batch to load
-   * @param[in] interval       Time interval between each frame
+   * @param[in] textureManager    The texture manager
+   * @param[in] size              The width and height to fit the loaded image to.
+   * @param[in] fittingMode       The FittingMode of the resource to load
+   * @param[in] samplingMode      The SamplingMode of the resource to load
+   * @param[in] urlList           List of urls to cache
+   * @param[in] maskingData       Masking data to be applied.
+   * @param[in] observer          FrameReady observer
+   * @param[in] batchSize         The size of a batch to load
+   * @param[in] interval          Time interval between each frame
+   * @param[in] preMultiplyOnLoad The flag if image's color should be multiplied by it's alpha
    *
    * This will start loading textures immediately, according to the
    * batch and cache sizes. The cache is as large as the number of urls.
@@ -53,7 +54,8 @@ public:
                   TextureManager::MaskingDataPointer& maskingData,
                   ImageCache::FrameReadyObserver&     observer,
                   uint32_t                            batchSize,
-                  uint32_t                            interval);
+                  uint32_t                            interval,
+                  bool                                preMultiplyOnLoad);
 
   ~FixedImageCache() override;
 
@@ -111,8 +113,9 @@ private:
    * @brief Check if the front frame has become ready - if so, inform observer
    *
    * @param[in] wasReady Readiness before call.
+   * @param[in] preMultiplied whether the texture is premultied alpha or not.
    */
-  void CheckFrontFrame(bool wasReady);
+  void CheckFrontFrame(bool wasReady, bool preMultiplied);
 
 protected:
   /**
index 3b5131f..41879c7 100644 (file)
@@ -29,7 +29,8 @@ ImageCache::ImageCache(TextureManager&                     textureManager,
                        TextureManager::MaskingDataPointer& maskingData,
                        ImageCache::FrameReadyObserver&     observer,
                        uint32_t                            batchSize,
-                       uint32_t                            interval)
+                       uint32_t                            interval,
+                       bool                                preMultiplyOnLoad)
 : mTextureManager(textureManager),
   mObserver(observer),
   mMaskingData(maskingData),
@@ -40,6 +41,7 @@ ImageCache::ImageCache(TextureManager&                     textureManager,
   mInterval(interval),
   mLoadState(TextureManager::LoadState::NOT_STARTED),
   mRequestingLoad(false),
+  mPreMultiplyOnLoad(preMultiplyOnLoad),
   mTextureManagerAlive(true)
 {
   mTextureManager.AddObserver(*this);
index f65d60b..b15101e 100644 (file)
@@ -40,8 +40,9 @@ public:
      * @brief Informs observer when the next texture set is ready to display
      * @param[in] textureSet The ready texture set
      * @param[in] interval interval(ms) for the frame
+     * @param[in] preMultiplied whether the texture is premultied alpha or not.
      */
-    virtual void FrameReady(TextureSet textureSet, uint32_t interval) = 0;
+    virtual void FrameReady(TextureSet textureSet, uint32_t interval, bool preMultiplied) = 0;
   };
 
   struct UrlStore
@@ -58,14 +59,15 @@ public:
 public:
   /**
    * @brief Constructor.
-   * @param[in] textureManager The texture manager
-   * @param[in] size           The width and height to fit the loaded image to.
-   * @param[in] fittingMode    The FittingMode of the resource to load
-   * @param[in] samplingMode   The SamplingMode of the resource to load
-   * @param[in] observer       FrameReady observer
-   * @param[in] maskingData    Masking data to be applied.
-   * @param[in] batchSize The size of a batch to load
-   * @param[in] interval Time interval(ms) between each frame
+   * @param[in] textureManager    The texture manager
+   * @param[in] size              The width and height to fit the loaded image to.
+   * @param[in] fittingMode       The FittingMode of the resource to load
+   * @param[in] samplingMode      The SamplingMode of the resource to load
+   * @param[in] observer          FrameReady observer
+   * @param[in] maskingData       Masking data to be applied.
+   * @param[in] batchSize         The size of a batch to load
+   * @param[in] interval          Time interval(ms) between each frame
+   * @param[in] preMultiplyOnLoad The flag if image's color should be multiplied by it's alpha
    *
    * This will start loading textures immediately, according to the
    * batch and cache sizes. The cache is as large as the number of urls.
@@ -77,7 +79,8 @@ public:
              TextureManager::MaskingDataPointer& maskingData,
              ImageCache::FrameReadyObserver&     observer,
              uint32_t                            batchSize,
-             uint32_t                            interval);
+             uint32_t                            interval,
+             bool                                preMultiplyOnLoad);
 
   virtual ~ImageCache();
 
@@ -152,6 +155,7 @@ protected:
   uint32_t                            mInterval;
   TextureManager::LoadState           mLoadState;
   bool                                mRequestingLoad : 1;
+  bool                                mPreMultiplyOnLoad : 1;
   bool                                mTextureManagerAlive : 1;
 };
 
index 995ea60..f23456c 100644 (file)
@@ -73,7 +73,7 @@ RollingAnimatedImageCache::RollingAnimatedImageCache(TextureManager&
                                                      const Dali::WrapMode::Type&         wrapModeV,
                                                      bool                                isSynchronousLoading,
                                                      bool                                preMultiplyOnLoad)
-: ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, 0u),
+: ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, 0u, preMultiplyOnLoad),
   mImageUrl(animatedImageLoading.GetUrl()),
   mAnimatedImageLoading(animatedImageLoading),
   mFrameCount(SINGLE_IMAGE_COUNT),
@@ -82,8 +82,7 @@ RollingAnimatedImageCache::RollingAnimatedImageCache(TextureManager&
   mQueue(cacheSize),
   mWrapModeU(wrapModeU),
   mWrapModeV(wrapModeV),
-  mIsSynchronousLoading(isSynchronousLoading),
-  mPreMultiplyOnLoad(preMultiplyOnLoad)
+  mIsSynchronousLoading(isSynchronousLoading)
 {
   mTextureIds.resize(mFrameCount);
   mIntervals.assign(mFrameCount, 0);
@@ -111,7 +110,10 @@ TextureSet RollingAnimatedImageCache::Frame(uint32_t frameIndex)
   bool synchronouslyLoaded = false;
   if(mIsSynchronousLoading && mQueue.IsEmpty())
   {
-    textureSet        = RequestFrameLoading(frameIndex, true);
+    auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
+                                                   : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+
+    textureSet        = RequestFrameLoading(frameIndex, true, preMultiplyOnLoading);
     batchFrameIndex   = (frameIndex + 1) % mFrameCount;
     uint32_t interval = 0u;
     if(textureSet)
@@ -119,7 +121,7 @@ TextureSet RollingAnimatedImageCache::Frame(uint32_t frameIndex)
       synchronouslyLoaded = true;
       interval            = mAnimatedImageLoading.GetFrameInterval(mQueue.Back().mFrameNumber);
     }
-    MakeFrameReady(synchronouslyLoaded, textureSet, interval);
+    MakeFrameReady(synchronouslyLoaded, textureSet, interval, preMultiplyOnLoading == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD);
   }
 
   if(popExist || mQueue.IsEmpty() || synchronouslyLoaded)
@@ -191,7 +193,15 @@ bool RollingAnimatedImageCache::IsFrontReady() const
   return (!mQueue.IsEmpty() && mQueue.Front().mReady);
 }
 
-TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, bool synchronousLoading)
+TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex)
+{
+  auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
+                                                 : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+
+  return RequestFrameLoading(frameIndex, false, preMultiplyOnLoading);
+}
+
+TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, bool synchronousLoading, TextureManager::MultiplyOnLoad& preMultiplyOnLoading)
 {
   ImageFrame imageFrame;
   imageFrame.mFrameNumber = frameIndex;
@@ -201,9 +211,6 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b
 
   mLoadState = TextureManager::LoadState::LOADING;
 
-  auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
-                                                 : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
-
   TextureManager::TextureId loadTextureId = TextureManager::INVALID_TEXTURE_ID;
   TextureSet                textureSet    = mTextureManager.LoadAnimatedImageTexture(mImageUrl,
                                                                    mAnimatedImageLoading,
@@ -238,7 +245,7 @@ void RollingAnimatedImageCache::LoadBatch(uint32_t frameIndex)
   {
     if(mLoadState != TextureManager::LoadState::LOADING)
     {
-      RequestFrameLoading(frameIndex, false);
+      RequestFrameLoading(frameIndex);
     }
     else
     {
@@ -309,12 +316,13 @@ void RollingAnimatedImageCache::ClearCache()
   mLoadState = TextureManager::LoadState::NOT_STARTED;
 }
 
-void RollingAnimatedImageCache::MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t interval)
+void RollingAnimatedImageCache::MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t interval, bool preMultiplied)
 {
   if(!loadSuccess)
   {
     mLoadState = TextureManager::LoadState::LOAD_FAILED;
-    mObserver.FrameReady(TextureSet(), 0);
+    // preMultiplied should be false because broken image don't premultiply alpha on load
+    mObserver.FrameReady(TextureSet(), 0, false);
   }
   else
   {
@@ -337,7 +345,7 @@ void RollingAnimatedImageCache::MakeFrameReady(bool loadSuccess, TextureSet text
     // If it is, notify frame ready to observer.
     if(frontFrameReady == false && IsFrontReady())
     {
-      mObserver.FrameReady(textureSet, interval);
+      mObserver.FrameReady(textureSet, interval, preMultiplied);
     }
   }
 }
@@ -354,7 +362,7 @@ void RollingAnimatedImageCache::LoadComplete(bool loadSuccess, TextureInformatio
     textureInformation.textureSet.SetSampler(0u, sampler);
   }
 
-  MakeFrameReady(loadSuccess, textureInformation.textureSet, textureInformation.interval);
+  MakeFrameReady(loadSuccess, textureInformation.textureSet, textureInformation.interval, textureInformation.preMultiplied);
 
   if(loadSuccess)
   {
@@ -365,7 +373,7 @@ void RollingAnimatedImageCache::LoadComplete(bool loadSuccess, TextureInformatio
     {
       uint32_t loadingIndex = mLoadWaitingQueue.front();
       mLoadWaitingQueue.erase(mLoadWaitingQueue.begin());
-      RequestFrameLoading(loadingIndex, false);
+      RequestFrameLoading(loadingIndex);
     }
     else if(mQueue.Count() == 1u && textureInformation.frameCount > SINGLE_IMAGE_COUNT)
     {
index c827e40..a42854b 100644 (file)
@@ -116,14 +116,25 @@ private:
   bool IsFrontReady() const;
 
   /**
+   * @brief Request to Load a frame asynchronously
+   *
+   * @param[in] frameIndex index of frame to be loaded.
+   *
+   * @return the texture set currently loaded.
+   */
+  TextureSet RequestFrameLoading(uint32_t frameIndex);
+
+  /**
    * @brief Request to Load a frame
    *
-   * @param[in] frameIndex          index of frame to be loaded.
-   * @param[in] synchronousLoading  true if the frame should be loaded synchronously
+   * @param[in] frameIndex             Index of frame to be loaded.
+   * @param[in] synchronousLoading     True if the frame should be loaded synchronously
+   * @param[in,out] preMultiplyOnLoad  True if the image color should be multiplied by it's alpha. Set to false if the
+   *                                   image has no alpha channel
    *
    * @return the texture set currently loaded.
    */
-  TextureSet RequestFrameLoading(uint32_t frameIndex, bool synchronousLoading);
+  TextureSet RequestFrameLoading(uint32_t frameIndex, bool synchronousLoading, TextureManager::MultiplyOnLoad& preMultiplyOnLoading);
 
   /**
    * @brief Load the next batch of images
@@ -159,8 +170,9 @@ private:
    * @param[in] loadSuccess whether the loading is succeded or not.
    * @param[in] textureSet textureSet for this frame.
    * @param[in] interval interval between this frame and next frame.
+   * @param[in] preMultiplied whether the texture is premultied alpha or not.
    */
-  void MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t interval);
+  void MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t interval, bool preMultiplied);
 
   /**
    * @brief Pop front entity of Cache.
@@ -195,7 +207,6 @@ private:
   Dali::WrapMode::Type       mWrapModeU : 3;
   Dali::WrapMode::Type       mWrapModeV : 3;
   bool                       mIsSynchronousLoading;
-  bool                       mPreMultiplyOnLoad;
 };
 
 } // namespace Internal
index 19f025d..99e12e6 100644 (file)
@@ -66,8 +66,9 @@ RollingImageCache::RollingImageCache(TextureManager&                     texture
                                      ImageCache::FrameReadyObserver&     observer,
                                      uint16_t                            cacheSize,
                                      uint16_t                            batchSize,
-                                     uint32_t                            interval)
-: ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, interval),
+                                     uint32_t                            interval,
+                                     bool                                preMultiplyOnLoad)
+: ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, interval, preMultiplyOnLoad),
   mImageUrls(urlList),
   mQueue(cacheSize)
 {
@@ -167,11 +168,13 @@ void RollingImageCache::LoadBatch(uint32_t frameIndex)
     ImageAtlasManagerPtr  imageAtlasManager  = nullptr;
     Vector4               textureRect;
     Dali::ImageDimensions textureRectSize;
-    auto                  preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+
+    auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
+                                                   : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
 
     TextureManager::TextureId loadTextureId = TextureManager::INVALID_TEXTURE_ID;
     TextureSet                textureSet    = mTextureManager.LoadTexture(
-      url, mDesiredSize, mFittingMode, mSamplingMode, mMaskingData, synchronousLoading, loadTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply);
+      url, mDesiredSize, mFittingMode, mSamplingMode, mMaskingData, synchronousLoading, loadTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiplyOnLoading);
     mImageUrls[imageFrame.mUrlIndex].mTextureId = loadTextureId;
 
     mRequestingLoad = false;
@@ -259,13 +262,14 @@ void RollingImageCache::LoadComplete(bool loadSuccess, TextureInformation textur
         sampler.SetWrapMode(Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT);
         textureInformation.textureSet.SetSampler(0u, sampler);
       }
-      mObserver.FrameReady(textureInformation.textureSet, mInterval);
+      mObserver.FrameReady(textureInformation.textureSet, mInterval, textureInformation.preMultiplied);
     }
   }
   else
   {
     mLoadState = TextureManager::LoadState::LOAD_FAILED;
-    mObserver.FrameReady(TextureSet(), 0);
+    // preMultiplied should be false because broken image don't premultiply alpha on load
+    mObserver.FrameReady(TextureSet(), 0, false);
   }
 
   LOG_CACHE;
index 8fbaad6..59fa6a7 100644 (file)
@@ -37,16 +37,17 @@ class RollingImageCache : public ImageCache, public TextureUploadObserver
 public:
   /**
    * Constructor.
-   * @param[in] textureManager The texture manager
-   * @param[in] size           The width and height to fit the loaded image to.
-   * @param[in] fittingMode    The FittingMode of the resource to load
-   * @param[in] samplingMode   The SamplingMode of the resource to load
-   * @param[in] urlList        List of urls to cache
-   * @param[in] maskingData    Masking data to be applied.
-   * @param[in] observer       FrameReady observer
-   * @param[in] cacheSize      The size of the cache
-   * @param[in] batchSize      The size of a batch to load
-   * @param[in] interval       Time interval between each frame
+   * @param[in] textureManager    The texture manager
+   * @param[in] size              The width and height to fit the loaded image to.
+   * @param[in] fittingMode       The FittingMode of the resource to load
+   * @param[in] samplingMode      The SamplingMode of the resource to load
+   * @param[in] urlList           List of urls to cache
+   * @param[in] maskingData       Masking data to be applied.
+   * @param[in] observer          FrameReady observer
+   * @param[in] cacheSize         The size of the cache
+   * @param[in] batchSize         The size of a batch to load
+   * @param[in] interval          Time interval between each frame
+   * @param[in] preMultiplyOnLoad The flag if image's color should be multiplied by it's alpha
    *
    * This will start loading textures immediately, according to the
    * batch and cache sizes.
@@ -60,7 +61,8 @@ public:
                     ImageCache::FrameReadyObserver&     observer,
                     uint16_t                            cacheSize,
                     uint16_t                            batchSize,
-                    uint32_t                            interval);
+                    uint32_t                            interval,
+                    bool                                preMultiplyOnLoad);
 
   /**
    * Destructor