* limitations under the License.
*/
+// CLASS HEADER
+#include "toolkit-bitmap-loader.h"
+
+// EXTERNAL INCLUDES
#include <dali/public-api/object/base-object.h>
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <cstring>
+#include <semaphore.h>
using namespace Dali;
namespace Dali
{
-class Adaptor;
+namespace
+{
+Dali::BitmapLoader gBitmapLoader;
+}
+
namespace Internal
{
mPixelData(),
mUrl(url)
{
+ sem_init( &mySemaphore, 0, 0 );
}
~BitmapLoader(){}
unsigned char* buffer = static_cast<unsigned char*>(malloc(bufferSize));
memset(buffer, 0, bufferSize);
- mPixelData = PixelData::New( buffer, mSize.GetWidth(), mSize.GetHeight(), Pixel::RGBA8888, PixelData::FREE);
+ mPixelData = Dali::PixelData::New( buffer, bufferSize, mSize.GetWidth(), mSize.GetHeight(), Pixel::RGBA8888, Dali::PixelData::FREE);
+
+ sem_post( &mySemaphore );
}
- PixelDataPtr GetPixelData() const
+ Dali::PixelData GetPixelData() const
{
return mPixelData;
}
return mPixelData ? true : false;
}
+ void WaitForLoading()
+ {
+ if( mPixelData )
+ {
+ return;
+ }
+ sem_wait( &mySemaphore );
+ }
+
ImageDimensions mSize;
- PixelDataPtr mPixelData;
+ Dali::PixelData mPixelData;
const std::string mUrl;
+ sem_t mySemaphore;
};
} // internal
Dali::BitmapLoader Dali::BitmapLoader::New(std::string const&url, Dali::Uint16Pair size, Dali::FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode, bool orientationCorrection)
{
IntrusivePtr<Internal::BitmapLoader> internal = Internal::BitmapLoader::New(url, size, fittingMode, samplingMode, orientationCorrection);
- return BitmapLoader( internal.Get() );
+ gBitmapLoader = BitmapLoader(internal.Get());
+ return gBitmapLoader;
+}
+
+BitmapLoader::BitmapLoader()
+{
}
Dali::BitmapLoader::BitmapLoader(Dali::BitmapLoader const& handle)
Dali::BitmapLoader::~BitmapLoader()
{
}
+BitmapLoader& BitmapLoader::operator=(const BitmapLoader& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
void Dali::BitmapLoader::Load()
{
GetImplementation(*this).Load();
}
-PixelDataPtr Dali::BitmapLoader::GetPixelData() const
+PixelData Dali::BitmapLoader::GetPixelData() const
{
return GetImplementation(*this).GetPixelData();
}
{
return GetImplementation(*this).IsLoaded();
}
+void Dali::BitmapLoader::WaitForLoading()
+{
+ GetImplementation(*this).WaitForLoading();
+}
+
+BitmapLoader Dali::BitmapLoader::GetLatestCreated()
+{
+ return gBitmapLoader;
+}
+
+void Dali::BitmapLoader::ResetLatestCreated()
+{
+ gBitmapLoader.Reset();
+}
} // Dali