Adding Async remote loading to ImageVisual
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / image-loader / async-image-loader-impl.cpp
index d25ea5c..8454992 100644 (file)
@@ -19,7 +19,6 @@
 #include "async-image-loader-impl.h"
 
 // EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
 #include <dali/integration-api/adaptors/adaptor.h>
 
 namespace Dali
@@ -34,7 +33,7 @@ namespace Internal
 AsyncImageLoader::AsyncImageLoader()
 : mLoadedSignal(),
   mLoadThread( new EventThreadCallback( MakeCallback( this, &AsyncImageLoader::ProcessLoadedImage ) ) ),
-  mLoadTaskId( 0 ),
+  mLoadTaskId( 0u ),
   mIsLoadThreadStarted( false )
 {
 }
@@ -50,8 +49,8 @@ IntrusivePtr<AsyncImageLoader> AsyncImageLoader::New()
   return internal;
 }
 
-uint32_t AsyncImageLoader::Load( const std::string& url,
-                                 ImageDimensions size,
+uint32_t AsyncImageLoader::Load( const VisualUrl& url,
+                                 ImageDimensions dimensions,
                                  FittingMode::Type fittingMode,
                                  SamplingMode::Type samplingMode,
                                  bool orientationCorrection )
@@ -62,9 +61,7 @@ uint32_t AsyncImageLoader::Load( const std::string& url,
     mIsLoadThreadStarted = true;
   }
 
-  BitmapLoader loader = BitmapLoader::New( url, size, fittingMode, samplingMode, orientationCorrection );
-
-  mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, loader ) );
+  mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection ) );
 
   return mLoadTaskId;
 }
@@ -86,9 +83,9 @@ void AsyncImageLoader::CancelAll()
 
 void AsyncImageLoader::ProcessLoadedImage()
 {
-  while( LoadingTask *next =  mLoadThread.NextCompletedTask() )
+  while( LoadingTask *next = mLoadThread.NextCompletedTask() )
   {
-    mLoadedSignal.Emit( next->id, next->loader.GetPixelData() );
+    mLoadedSignal.Emit( next->id, next->pixelData );
     delete next;
   }
 }