// CLASS HEADER
#include "image-load-thread.h"
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/image-loading.h>
+
namespace Dali
{
namespace Internal
{
-LoadingTask::LoadingTask(uint32_t id, BitmapLoader loader )
-: loader( loader ),
- id( id )
+LoadingTask::LoadingTask( uint32_t id, const std::string& url, ImageDimensions dimensions,
+ FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection )
+: pixelData(),
+ url( url ),
+ id( id ),
+ dimensions( dimensions ),
+ fittingMode( fittingMode ),
+ samplingMode( samplingMode ),
+ orientationCorrection( orientationCorrection )
+{
+}
+
+void LoadingTask::Load()
{
+ pixelData = Dali::LoadImageFromFile( url, dimensions, fittingMode, samplingMode, orientationCorrection );
}
+
ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger )
: mTrigger( trigger )
{
void ImageLoadThread::Run()
{
- while( LoadingTask* task = NextTaskToProcess())
+ while( LoadingTask* task = NextTaskToProcess() )
{
- task->loader.Load();
+ task->Load();
AddCompletedTask( task );
}
}
mLoadQueue.PushBack( task );
}
- if( wasEmpty)
+ if( wasEmpty )
{
// wake up the image loading thread
mConditionalWait.Notify();
// Lock while remove task from the queue
ConditionalWait::ScopedLock lock( mConditionalWait );
- for( Vector< LoadingTask* >::Iterator iter = mLoadQueue.Begin(); iter != mLoadQueue.End(); iter++ )
+ for( Vector< LoadingTask* >::Iterator iter = mLoadQueue.Begin(); iter != mLoadQueue.End(); ++iter )
{
if( (*iter)->id == loadingTaskId )
{
// Lock while remove task from the queue
ConditionalWait::ScopedLock lock( mConditionalWait );
- for( Vector< LoadingTask* >::Iterator iter = mLoadQueue.Begin(); iter != mLoadQueue.End(); iter++ )
+ for( Vector< LoadingTask* >::Iterator iter = mLoadQueue.Begin(); iter != mLoadQueue.End(); ++iter )
{
- delete (*iter);
+ delete ( *iter );
}
mLoadQueue.Clear();
}
mTrigger->Trigger();
}
-
-
} // namespace Internal
} // namespace Toolkit