From 716456f869528d22c2a9fac7d1d1f41a41aa439f Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Tue, 10 Sep 2019 09:36:28 +0900 Subject: [PATCH] Force order, Premultiply alpha after alpha mask. - Force to premultiply alpha after apply alpha mask if there is alpha mask. Change-Id: I25c8c6a20dcbd39656d195abbff6ca6b4d18a008 Signed-off-by: Seungho, Baek --- .../src/dali-toolkit/utc-Dali-ImageVisual.cpp | 156 +++++++-------------- .../image-loader/async-image-loader-devel.cpp | 5 +- .../image-loader/async-image-loader-devel.h | 6 +- .../image-loader/async-image-loader-impl.cpp | 5 +- .../image-loader/async-image-loader-impl.h | 4 +- .../internal/image-loader/image-load-thread.cpp | 19 ++- .../internal/image-loader/image-load-thread.h | 11 +- .../internal/visuals/texture-manager-impl.cpp | 17 ++- .../internal/visuals/texture-manager-impl.h | 6 +- 9 files changed, 97 insertions(+), 132 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp index 834b05c..8cbab66 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp @@ -318,6 +318,55 @@ int UtcDaliImageVisualNoPremultipliedAlpha02(void) DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION ); + int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); + int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); + int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); + int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA ); + DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA ); + DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE ); + DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA ); + + textureTrace.Reset(); + + // Make a new visual with the same image + Visual::Base newVisual = factory.CreateVisual( propertyMap ); + DALI_TEST_CHECK( newVisual ); + + // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied. + // Image with a size smaller than 512*512 will be uploaded as a part of the atlas. + + DummyControl newActor = DummyControl::New(); + DummyControlImpl& newDummyImpl = static_cast< DummyControlImpl& >( newActor.GetImplementation() ); + newDummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, newVisual ); + + newActor.SetSize( 200.f, 200.f ); + DALI_TEST_EQUALS( newActor.GetRendererCount(), 0u, TEST_LOCATION ); + + Stage::GetCurrent().Add( newActor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( newActor.GetRendererCount(), 1u, TEST_LOCATION ); + auto newRenderer = newActor.GetRendererAt( 0 ); + preMultipliedIndex = newRenderer.GetPropertyIndex( "preMultipliedAlpha" ); + DALI_TEST_CHECK( preMultipliedIndex != Property::INVALID_INDEX ); + preMultipliedAlpha = newRenderer.GetProperty< bool >( preMultipliedIndex ); + preMultipliedAlpha2 = newRenderer.GetProperty< bool >( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); + + DALI_TEST_EQUALS( preMultipliedAlpha, false, TEST_LOCATION ); + DALI_TEST_EQUALS( preMultipliedAlpha2, false, TEST_LOCATION ); + + srcFactorRgb = newRenderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); + destFactorRgb = newRenderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); + srcFactorAlpha = newRenderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); + destFactorAlpha = newRenderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA ); + DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA ); + DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE ); + DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA ); + Stage::GetCurrent().Remove( actor ); DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); @@ -1313,113 +1362,6 @@ int UtcDaliImageVisualAlphaMask(void) END_TEST; } -int UtcDaliImageVisualJpgAlphaMask(void) -{ - ToolkitTestApplication application; - tet_infoline( "Request image visual with a Property::Map containing 24 bit image and an Alpha mask" ); - - VisualFactory factory = VisualFactory::Get(); - DALI_TEST_CHECK( factory ); - - Property::Map propertyMap; - propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ); - propertyMap.Insert( ImageVisual::Property::ALPHA_MASK_URL, TEST_MASK_IMAGE_FILE_NAME ); - - Visual::Base visual = factory.CreateVisual( propertyMap ); - DALI_TEST_CHECK( visual ); - - Property::Map testMap; - visual.CreatePropertyMap( testMap ); - DALI_TEST_EQUALS( *testMap.Find( ImageVisual::Property::ALPHA_MASK_URL ), Property::Value( TEST_MASK_IMAGE_FILE_NAME ), TEST_LOCATION ); - - // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied. - // Image with a size smaller than 512*512 will be uploaded as a part of the atlas. - - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& textureTrace = gl.GetTextureTrace(); - textureTrace.Enable( true ); - - DummyControl actor = DummyControl::New(); - DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() ); - dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual ); - - actor.SetSize( 200.f, 200.f ); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.IsResourceReady(), false, TEST_LOCATION ); - - Stage::GetCurrent().Add( actor ); - application.SendNotification(); - application.Render(); - - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION ); - - application.SendNotification(); - application.Render(); - - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( textureTrace.FindMethod( "BindTexture" ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.IsResourceReady(), true, TEST_LOCATION ); - - // Should not be pre-multiplied - Renderer renderer = actor.GetRendererAt( 0 ); - Property::Value value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); - - bool enable; - DALI_TEST_CHECK( value.Get( enable ) ); - DALI_TEST_CHECK( !enable ); - - int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); - int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); - int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); - int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); - DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA ); - DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA ); - DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE ); - DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA ); - - // Make a new visual with the same image - Visual::Base newVisual = factory.CreateVisual( propertyMap ); - DALI_TEST_CHECK( newVisual ); - - DummyControl newActor = DummyControl::New(); - DummyControlImpl& newDummyImpl = static_cast< DummyControlImpl& >( newActor.GetImplementation() ); - newDummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, newVisual ); - - newActor.SetSize( 200.f, 200.f ); - DALI_TEST_EQUALS( newActor.GetRendererCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( newActor.IsResourceReady(), false, TEST_LOCATION ); - - Stage::GetCurrent().Add( newActor ); - - application.SendNotification(); - application.Render(); - - DALI_TEST_EQUALS( newActor.GetRendererCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( textureTrace.FindMethod( "BindTexture" ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( newActor.IsResourceReady(), true, TEST_LOCATION ); - - // Should not be pre-multiplied - renderer = newActor.GetRendererAt( 0 ); - value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); - DALI_TEST_CHECK( value.Get( enable ) ); - DALI_TEST_CHECK( !enable ); - - srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); - destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); - srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); - destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); - DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA ); - DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA ); - DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE ); - DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA ); - - dummyImpl.UnregisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1 ); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); - - END_TEST; -} - int UtcDaliImageVisualRemoteAlphaMask(void) { ToolkitTestApplication application; diff --git a/dali-toolkit/devel-api/image-loader/async-image-loader-devel.cpp b/dali-toolkit/devel-api/image-loader/async-image-loader-devel.cpp index 3bd3368..5fc985f 100644 --- a/dali-toolkit/devel-api/image-loader/async-image-loader-devel.cpp +++ b/dali-toolkit/devel-api/image-loader/async-image-loader-devel.cpp @@ -39,9 +39,10 @@ uint32_t ApplyMask( AsyncImageLoader asyncImageLoader, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, - bool cropToMask ) + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad ) { - return GetImplementation( asyncImageLoader ).ApplyMask( pixelBuffer, maskPixelBuffer, contentScale, cropToMask ); + return GetImplementation( asyncImageLoader ).ApplyMask( pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad ); } PixelBufferLoadedSignalType& PixelBufferLoadedSignal( AsyncImageLoader asyncImageLoader ) diff --git a/dali-toolkit/devel-api/image-loader/async-image-loader-devel.h b/dali-toolkit/devel-api/image-loader/async-image-loader-devel.h index 681c00b..99ca154 100644 --- a/dali-toolkit/devel-api/image-loader/async-image-loader-devel.h +++ b/dali-toolkit/devel-api/image-loader/async-image-loader-devel.h @@ -49,7 +49,7 @@ enum class PreMultiplyOnLoad * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header - * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha + * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask. * @return The loading task id */ DALI_TOOLKIT_API uint32_t Load( AsyncImageLoader asyncImageLoader, @@ -69,13 +69,15 @@ DALI_TOOLKIT_API uint32_t Load( AsyncImageLoader asyncImageLoader, * @param[in] maskPixelBuffer Pointer to raw masking data * @param[in] contentScale The factor to scale the content * @param[in] cropToMask Whether to crop the content to the mask size + * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha. * @return The masking task id */ DALI_TOOLKIT_API uint32_t ApplyMask( AsyncImageLoader asyncImageLoader, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, - bool cropToMask ); + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad ); /** * Connect to this signal if you want to load a PixelBuffer instead of a PixelData. diff --git a/dali-toolkit/internal/image-loader/async-image-loader-impl.cpp b/dali-toolkit/internal/image-loader/async-image-loader-impl.cpp index 62a3fdd..6fe8eba 100644 --- a/dali-toolkit/internal/image-loader/async-image-loader-impl.cpp +++ b/dali-toolkit/internal/image-loader/async-image-loader-impl.cpp @@ -69,14 +69,15 @@ uint32_t AsyncImageLoader::Load( const VisualUrl& url, uint32_t AsyncImageLoader::ApplyMask( Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, - bool cropToMask ) + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad) { if( !mIsLoadThreadStarted ) { mLoadThread.Start(); mIsLoadThreadStarted = true; } - mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, pixelBuffer, maskPixelBuffer, contentScale, cropToMask ) ); + mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad ) ); return mLoadTaskId; } diff --git a/dali-toolkit/internal/image-loader/async-image-loader-impl.h b/dali-toolkit/internal/image-loader/async-image-loader-impl.h index 69a7617..a97088d 100644 --- a/dali-toolkit/internal/image-loader/async-image-loader-impl.h +++ b/dali-toolkit/internal/image-loader/async-image-loader-impl.h @@ -65,12 +65,14 @@ public: * @param[in] maskPixelBuffer of the mask image * @param[in] contentScale The factor to scale the content * @param[in] cropToMask Whether to crop the content to the mask size + * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha. * @return The loading task id */ uint32_t ApplyMask( Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, - bool cropToMask ); + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad ); /** * @copydoc Toolkit::AsyncImageLoader::ImageLoadedSignal diff --git a/dali-toolkit/internal/image-loader/image-load-thread.cpp b/dali-toolkit/internal/image-loader/image-load-thread.cpp index 9756608..213173a 100644 --- a/dali-toolkit/internal/image-loader/image-load-thread.cpp +++ b/dali-toolkit/internal/image-loader/image-load-thread.cpp @@ -49,7 +49,8 @@ LoadingTask::LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dim { } -LoadingTask::LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, bool cropToMask ) +LoadingTask::LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad ) : pixelBuffer( pixelBuffer ), url( "" ), id( id ), @@ -57,7 +58,7 @@ LoadingTask::LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::Pi fittingMode(), samplingMode(), orientationCorrection(), - preMultiplyOnLoad(), + preMultiplyOnLoad( preMultiplyOnLoad ), isMaskTask( true ), maskPixelBuffer( maskPixelBuffer ), contentScale( contentScale ), @@ -75,7 +76,15 @@ void LoadingTask::Load() { pixelBuffer = Dali::DownloadImageSynchronously ( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection ); } +} + +void LoadingTask::ApplyMask() +{ + pixelBuffer.ApplyMask( maskPixelBuffer, contentScale, cropToMask ); +} +void LoadingTask::MultiplyAlpha() +{ if( pixelBuffer && Pixel::HasAlpha( pixelBuffer.GetPixelFormat() ) ) { if( preMultiplyOnLoad == DevelAsyncImageLoader::PreMultiplyOnLoad::ON ) @@ -85,11 +94,6 @@ void LoadingTask::Load() } } -void LoadingTask::ApplyMask() -{ - pixelBuffer.ApplyMask( maskPixelBuffer, contentScale, cropToMask ); -} - ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger ) : mTrigger( trigger ), mLogFactory( Dali::Adaptor::Get().GetLogFactory() ) @@ -121,6 +125,7 @@ void ImageLoadThread::Run() { task->ApplyMask(); } + task->MultiplyAlpha(); AddCompletedTask( task ); } diff --git a/dali-toolkit/internal/image-loader/image-load-thread.h b/dali-toolkit/internal/image-loader/image-load-thread.h index 53f6e47..779541a 100644 --- a/dali-toolkit/internal/image-loader/image-load-thread.h +++ b/dali-toolkit/internal/image-loader/image-load-thread.h @@ -52,7 +52,7 @@ struct LoadingTask * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter. * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size. * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header. - * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. + * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask. */ LoadingTask( uint32_t id, const VisualUrl& url, @@ -69,12 +69,14 @@ struct LoadingTask * @param [in] maskPixelBuffer of the mask image * @param [in] contentScale The factor to scale the content * @param [in] cropToMask Whether to crop the content to the mask size + * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha. */ LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, - bool cropToMask ); + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad); /** * Load the image @@ -86,6 +88,11 @@ struct LoadingTask */ void ApplyMask(); + /** + * Multiply alpha + */ + void MultiplyAlpha(); + private: // Undefined diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.cpp b/dali-toolkit/internal/visuals/texture-manager-impl.cpp index 6f1aadb..6dcc2fc 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.cpp +++ b/dali-toolkit/internal/visuals/texture-manager-impl.cpp @@ -707,7 +707,8 @@ void TextureManager::LoadTexture( TextureInfo& textureInfo, TextureUploadObserve { auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders; auto loadingHelperIt = loadersContainer.GetNext(); - auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF; + auto premultiplyOnLoad = ( textureInfo.preMultiplyOnLoad && textureInfo.maskTextureId == INVALID_TEXTURE_ID ) ? + DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF; DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End()); loadingHelperIt->Load(textureInfo.textureId, textureInfo.url, textureInfo.desiredSize, textureInfo.fittingMode, @@ -893,8 +894,9 @@ void TextureManager::ApplyMask( TextureInfo& textureInfo, TextureId maskTextureI textureInfo.loadState = MASK_APPLYING; auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders; auto loadingHelperIt = loadersContainer.GetNext(); + auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad ? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF; DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End()); - loadingHelperIt->ApplyMask( textureInfo.textureId, pixelBuffer, maskPixelBuffer, textureInfo.scaleFactor, textureInfo.cropToMask ); + loadingHelperIt->ApplyMask( textureInfo.textureId, pixelBuffer, maskPixelBuffer, textureInfo.scaleFactor, textureInfo.cropToMask, premultiplyOnLoad ); } } @@ -1155,13 +1157,14 @@ void TextureManager::AsyncLoadingHelper::Load(TextureId textureId, } void TextureManager::AsyncLoadingHelper::ApplyMask( TextureId textureId, - Devel::PixelBuffer pixelBuffer, - Devel::PixelBuffer maskPixelBuffer, - float contentScale, - bool cropToMask ) + Devel::PixelBuffer pixelBuffer, + Devel::PixelBuffer maskPixelBuffer, + float contentScale, + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad ) { mLoadingInfoContainer.push_back(AsyncLoadingInfo(textureId)); - auto id = DevelAsyncImageLoader::ApplyMask( mLoader, pixelBuffer, maskPixelBuffer, contentScale, cropToMask ); + auto id = DevelAsyncImageLoader::ApplyMask( mLoader, pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad ); mLoadingInfoContainer.back().loadId = id; } diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.h b/dali-toolkit/internal/visuals/texture-manager-impl.h index ca899fd..b782517 100755 --- a/dali-toolkit/internal/visuals/texture-manager-impl.h +++ b/dali-toolkit/internal/visuals/texture-manager-impl.h @@ -712,7 +712,7 @@ private: * @param[in] samplingMode The SamplingMode to use * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image, * e.g., from portrait to landscape - * @param[in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. + * @param[in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask. */ void Load(TextureId textureId, const VisualUrl& url, @@ -729,12 +729,14 @@ private: * @param [in] maskPixelBuffer of the mask image * @param [in] contentScale The factor to scale the content * @param [in] cropToMask Whether to crop the content to the mask size + * @param [in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha. */ void ApplyMask( TextureId textureId, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, - bool cropToMask ); + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad ); public: AsyncLoadingHelper(const AsyncLoadingHelper&) = delete; -- 2.7.4