// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/image-loading.h>
-#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/devel-api/adaptor-framework/thread-settings.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
+#include <dali/integration-api/debug.h>
namespace Dali
{
{
}
-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 ),
fittingMode(),
samplingMode(),
orientationCorrection(),
- preMultiplyOnLoad(),
+ preMultiplyOnLoad( preMultiplyOnLoad ),
isMaskTask( true ),
maskPixelBuffer( maskPixelBuffer ),
contentScale( contentScale ),
pixelBuffer = Dali::DownloadImageSynchronously ( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection );
}
- if( pixelBuffer && Pixel::HasAlpha( pixelBuffer.GetPixelFormat() ) )
+ if( !pixelBuffer )
{
- if( preMultiplyOnLoad == DevelAsyncImageLoader::PreMultiplyOnLoad::ON )
- {
- pixelBuffer.MultiplyColorByAlpha();
- }
+ DALI_LOG_ERROR( "LoadingTask::Load: Loading is failed: %s\n", url.GetUrl().c_str() );
}
}
pixelBuffer.ApplyMask( maskPixelBuffer, contentScale, cropToMask );
}
+void LoadingTask::MultiplyAlpha()
+{
+ if( pixelBuffer && Pixel::HasAlpha( pixelBuffer.GetPixelFormat() ) )
+ {
+ if( preMultiplyOnLoad == DevelAsyncImageLoader::PreMultiplyOnLoad::ON )
+ {
+ pixelBuffer.MultiplyColorByAlpha();
+ }
+ }
+}
+
ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger )
: mTrigger( trigger ),
mLogFactory( Dali::Adaptor::Get().GetLogFactory() )
{
task->ApplyMask();
}
+ task->MultiplyAlpha();
AddCompletedTask( task );
}