[Tizen] Add AlphaMask to synchronousLoading
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 27 Dec 2019 08:44:07 +0000 (17:44 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Fri, 27 Dec 2019 08:44:15 +0000 (17:44 +0900)
This reverts commit 88d12807a2c8ca2d6936df37c39833579ce4bd82.

Change-Id: Ieda9e804e7418968453ee056175ee51d90ed2c9b

dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/texture-manager-impl.cpp

index 8607fa8..e339995 100644 (file)
@@ -427,8 +427,6 @@ void ImageVisual::DoSetProperty( Property::Index index, const Property::Value& v
         AllocateMaskData();
         // Immediately trigger the alpha mask loading (it may just get a cached value)
         mMaskingData->mAlphaMaskUrl = alphaUrl;
-        TextureManager& textureManager = mFactoryCache.GetTextureManager();
-        mMaskingData->mAlphaMaskId = textureManager.RequestMaskLoad( alphaUrl );
       }
       break;
     }
index 6dcc2fc..57384b3 100644 (file)
@@ -182,6 +182,15 @@ TextureSet TextureManager::LoadTexture(
     {
       Devel::PixelBuffer pixelBuffer = LoadImageFromFile( url.GetUrl(), desiredSize, fittingMode, samplingMode,
                                        orientationCorrection  );
+      if( maskInfo )
+      {
+        Devel::PixelBuffer maskPixelBuffer = LoadImageFromFile( maskInfo->mAlphaMaskUrl.GetUrl(), ImageDimensions(),
+                                             FittingMode::SCALE_TO_FILL, SamplingMode::NO_FILTER, true  );
+        if( maskPixelBuffer )
+        {
+          pixelBuffer.ApplyMask( maskPixelBuffer, maskInfo->mContentScaleFactor, maskInfo->mCropToMask );
+        }
+      }
       if( pixelBuffer )
       {
         PreMultiply( pixelBuffer, preMultiplyOnLoad );
@@ -243,8 +252,9 @@ TextureSet TextureManager::LoadTexture(
       }
       else
       {
+        TextureId alphaMaskId = RequestMaskLoad( maskInfo->mAlphaMaskUrl );
         textureId = RequestLoad( url,
-                                 maskInfo->mAlphaMaskId,
+                                 alphaMaskId,
                                  maskInfo->mContentScaleFactor,
                                  desiredSize,
                                  fittingMode, samplingMode,