[3.0] Add DALI_IMPORT_API for reference
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / tizen / tizen-platform-abstraction.cpp
index 968e268..338f5da 100644 (file)
 #include <dali/integration-api/bitmap.h>
 #include <dali/integration-api/resource-types.h>
 
+// INTERNAL INCLUDES
 #include "resource-loader/resource-loader.h"
-
-#include "tizen-font-configuration-parser.h"
 #include "image-loaders/image-loader.h"
+#include "portable/file-closer.h"
 
 namespace Dali
 {
@@ -43,12 +43,6 @@ Integration::PlatformAbstraction* CreatePlatformAbstraction()
 namespace TizenPlatform
 {
 
-namespace
-{
-const std::string FONT_CONFIGURATION_FILE( FONT_CONFIGURATION_FILE_PATH ); ///< Default font configuration file
-const unsigned int NANOSECS_TO_MICROSECS( 1000 );                          ///< 1000 nanoseconds = 1 microsecond
-}
-
 TizenPlatformAbstraction::TizenPlatformAbstraction()
 : mResourceLoader(new ResourceLoader),
   mDataStoragePath( "" )
@@ -60,14 +54,6 @@ TizenPlatformAbstraction::~TizenPlatformAbstraction()
   delete mResourceLoader;
 }
 
-void TizenPlatformAbstraction::GetTimeMicroseconds(unsigned int &seconds, unsigned int &microSeconds)
-{
-  timespec time;
-  clock_gettime(CLOCK_MONOTONIC, &time);
-  seconds = time.tv_sec;
-  microSeconds = time.tv_nsec / NANOSECS_TO_MICROSECS;
-}
-
 void TizenPlatformAbstraction::Suspend()
 {
   if (mResourceLoader)
@@ -84,11 +70,6 @@ void TizenPlatformAbstraction::Resume()
   }
 }
 
-void TizenPlatformAbstraction::GetDefaultFontDescription( std::string& fontFamily, std::string& fontStyle ) const
-{
-  FontConfigurationParser::Parse(FONT_CONFIGURATION_FILE, fontFamily, fontStyle);
-}
-
 int TizenPlatformAbstraction::GetDefaultFontSize() const
 {
   int fontSize( -1 );
@@ -131,6 +112,25 @@ Integration::ResourcePointer TizenPlatformAbstraction::LoadResourceSynchronously
   return ImageLoader::LoadResourceSynchronously( resourceType, resourcePath );
 }
 
+Integration::BitmapPtr TizenPlatformAbstraction::DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t size )
+{
+  Integration::BitmapPtr bitmap = 0;
+
+  Dali::Internal::Platform::FileCloser fileCloser( buffer, size, "rb" );
+  FILE * const fp = fileCloser.GetFile();
+  if( fp )
+  {
+    bool result = ImageLoader::ConvertStreamToBitmap( resourceType, "", fp, StubbedResourceLoadingClient(), bitmap );
+    if ( !result || !bitmap )
+    {
+      bitmap.Reset();
+      DALI_LOG_WARNING( "Unable to decode bitmap supplied as in-memory blob.\n" );
+    }
+  }
+
+  return bitmap;
+}
+
 void TizenPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
 {
   if (mResourceLoader)