X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fimage-load-thread.cpp;h=320911da0c05bc73e6cb3b3ede3ea5a63efac5a7;hb=d222ce80a14a832bf738fb7c8036e7bd4bc6dd29;hp=d0b504d262729f5b8f26631991fd8fbe6a9abf46;hpb=a68dbe03813fd3db34c81f4e6960572e8882930b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/image-loader/image-load-thread.cpp b/dali-toolkit/internal/image-loader/image-load-thread.cpp index d0b504d..320911d 100644 --- a/dali-toolkit/internal/image-loader/image-load-thread.cpp +++ b/dali-toolkit/internal/image-loader/image-load-thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ // EXTERNAL INCLUDES #include +#include +#include namespace Dali { @@ -30,26 +32,43 @@ namespace Toolkit namespace Internal { -LoadingTask::LoadingTask( uint32_t id, const std::string& url, ImageDimensions dimensions, - FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection ) -: pixelData(), +LoadingTask::LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dimensions, + FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad ) +: pixelBuffer(), url( url ), id( id ), dimensions( dimensions ), fittingMode( fittingMode ), samplingMode( samplingMode ), - orientationCorrection( orientationCorrection ) + orientationCorrection( orientationCorrection ), + preMultiplyOnLoad( preMultiplyOnLoad ) { } void LoadingTask::Load() { - pixelData = Dali::LoadImageFromFile( url, dimensions, fittingMode, samplingMode, orientationCorrection ); + if( url.IsLocalResource() ) + { + pixelBuffer = Dali::LoadImageFromFile( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection ); + } + else + { + pixelBuffer = Dali::DownloadImageSynchronously ( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection ); + } + + if( pixelBuffer && Pixel::HasAlpha( pixelBuffer.GetPixelFormat() ) ) + { + if( preMultiplyOnLoad == DevelAsyncImageLoader::PreMultiplyOnLoad::ON ) + { + pixelBuffer.MultiplyColorByAlpha(); + } + } } ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger ) -: mTrigger( trigger ) +: mTrigger( trigger ), + mLogFactory( Dali::Adaptor::Get().GetLogFactory() ) { } @@ -65,6 +84,9 @@ ImageLoadThread::~ImageLoadThread() void ImageLoadThread::Run() { + SetThreadName( "ImageLoadThread" ); + mLogFactory.InstallLogFunction(); + while( LoadingTask* task = NextTaskToProcess() ) { task->Load();