X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fimage-load-thread.cpp;h=74d3e3972f186f3a1b73c84a601c6858eac762f7;hb=679dd19ad581013971018b16212ef551b5c6cd31;hp=11e251a0d53942f5ce2e221d78aba771b073127c;hpb=928f30d2caf2775c5bcbfd84ceb4bf37ca29f020;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 11e251a..74d3e39 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. @@ -18,6 +18,11 @@ // CLASS HEADER #include "image-load-thread.h" +// EXTERNAL INCLUDES +#include +#include +#include + namespace Dali { @@ -27,14 +32,34 @@ namespace Toolkit namespace Internal { -LoadingTask::LoadingTask(uint32_t id, BitmapLoader loader ) -: loader( loader ), - id( id ) +LoadingTask::LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dimensions, + FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection ) +: pixelBuffer(), + url( url ), + id( id ), + dimensions( dimensions ), + fittingMode( fittingMode ), + samplingMode( samplingMode ), + orientationCorrection( orientationCorrection ) +{ +} + +void LoadingTask::Load() { + if( url.IsLocalResource() ) + { + pixelBuffer = Dali::LoadImageFromFile( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection ); + } + else + { + pixelBuffer = Dali::DownloadImageSynchronously ( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection ); + } } + ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger ) -: mTrigger( trigger ) +: mTrigger( trigger ), + mLogFactory( Dali::Adaptor::Get().GetLogFactory() ) { } @@ -50,9 +75,12 @@ ImageLoadThread::~ImageLoadThread() void ImageLoadThread::Run() { + SetThreadName( "ImageLoadThread" ); + mLogFactory.InstallLogFunction(); + while( LoadingTask* task = NextTaskToProcess() ) { - task->loader.Load(); + task->Load(); AddCompletedTask( task ); } } @@ -150,8 +178,6 @@ void ImageLoadThread::AddCompletedTask( LoadingTask* task ) mTrigger->Trigger(); } - - } // namespace Internal } // namespace Toolkit