DALi Version 1.2.44
[platform/core/uifw/dali-adaptor.git] / adaptors / common / bitmap-loader-impl.cpp
index 1e6c545..9cef7ee 100644 (file)
@@ -18,8 +18,8 @@
 #include <string>
 
 // INTERNAL INCLUDES
+#include "image-loading.h"
 #include "bitmap-loader-impl.h"
-#include "image-loaders/image-loader.h"
 
 namespace Dali
 {
@@ -37,14 +37,16 @@ IntrusivePtr<BitmapLoader> BitmapLoader::New(const std::string& url,
 }
 
 BitmapLoader::BitmapLoader(const std::string& url,
-             ImageDimensions size,
-             FittingMode::Type fittingMode,
-             SamplingMode::Type samplingMode,
-             bool orientationCorrection)
-: mResourceType( size, fittingMode, samplingMode, orientationCorrection ),
-  mBitmap(NULL),
+                           ImageDimensions size,
+                           FittingMode::Type fittingMode,
+                           SamplingMode::Type samplingMode,
+                           bool orientationCorrection )
+: mPixelData(),
   mUrl(url),
-  mIsLoaded( false )
+  mSize( size ),
+  mFittingMode( fittingMode ),
+  mSamplingMode( samplingMode ),
+  mOrientationCorrection( orientationCorrection )
 {
 }
 
@@ -54,55 +56,22 @@ BitmapLoader::~BitmapLoader()
 
 void BitmapLoader::Load()
 {
-  IntrusivePtr<Dali::RefObject> resource = TizenPlatform::ImageLoader::LoadResourceSynchronously( mResourceType, mUrl );
-
-  mBitmap = static_cast<Integration::Bitmap*>(resource.Get());
-  mIsLoaded = true;
+  mPixelData = Dali::LoadImageFromFile( mUrl, mSize, mFittingMode, mSamplingMode, mOrientationCorrection );
 }
 
 bool BitmapLoader::IsLoaded()
 {
-  return mIsLoaded;
-}
-
-unsigned char* BitmapLoader::GetPixelData() const
-{
-  if( mIsLoaded )
-  {
-    return mBitmap->GetBuffer();
-  }
-
-  return NULL;
+  return mPixelData ? true : false ;
 }
 
-unsigned int BitmapLoader::GetImageHeight() const
+const std::string& BitmapLoader::GetUrl() const
 {
-  if( mIsLoaded )
-  {
-    return mBitmap->GetImageHeight();
-  }
-
-  return 0u;
+  return mUrl;
 }
 
-unsigned int BitmapLoader::GetImageWidth() const
+Dali::PixelData BitmapLoader::GetPixelData() const
 {
-  if( mIsLoaded )
-  {
-    return mBitmap->GetImageWidth();
-  }
-
-  return 0u;
-}
-
-Pixel::Format BitmapLoader::GetPixelFormat() const
-{
-  if( mIsLoaded )
-  {
-    return mBitmap->GetPixelFormat();
-  }
-
-  return Pixel::RGBA8888;
+  return mPixelData;
 }
 
 } // namespace Internal