Parallelize PlatformAbstraction image loading tests
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / slp / resource-loader / resource-loader.cpp
index 66efbf2..309328a 100755 (executable)
@@ -195,17 +195,6 @@ struct ResourceLoader::ResourceLoaderImpl
     }
   }
 
-  ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
-  {
-    ResourcePointer ptr;
-    ResourceRequesterBase* requester = GetRequester(resourceType.id);
-    if( requester )
-    {
-      ptr = requester->LoadResourceSynchronously( resourceType, resourcePath );
-    }
-    return ptr;
-  }
-
   void SaveResource(const ResourceRequest& request)
   {
     ResourceRequesterBase* requester = GetRequester( request.GetType()->id );
@@ -253,6 +242,7 @@ struct ResourceLoader::ResourceLoaderImpl
   bool IsLoading()
   {
     // TODO - not used - remove?
+    DALI_ASSERT_DEBUG( 0 == "IsLoading() Is not implemented so don't call it." );
     return true;
   }
 
@@ -306,30 +296,6 @@ struct ResourceLoader::ResourceLoaderImpl
     }
   }
 
-  void GetClosestImageSize( const std::string& filename,
-                            const ImageAttributes& attributes,
-                            Vector2& closestSize )
-  {
-    ResourceRequesterBase* requester = GetRequester(ResourceBitmap);
-    ResourceBitmapRequester* bitmapRequester = dynamic_cast<ResourceBitmapRequester*>(requester);
-    if( bitmapRequester != NULL )
-    {
-      bitmapRequester->GetClosestImageSize( filename, attributes, closestSize );
-    }
-  }
-
-  void GetClosestImageSize( ResourcePointer resourceBuffer,
-                            const ImageAttributes& attributes,
-                            Vector2& closestSize )
-  {
-    ResourceRequesterBase* requester = GetRequester(ResourceBitmap);
-    ResourceBitmapRequester* bitmapRequester = dynamic_cast<ResourceBitmapRequester*>(requester);
-    if( bitmapRequester != NULL )
-    {
-      bitmapRequester->GetClosestImageSize( resourceBuffer, attributes, closestSize );
-    }
-  }
-
   void AddPartiallyLoadedResource( LoadedResource& resource)
   {
     // Lock the LoadedQueue to store the loaded resource
@@ -474,11 +440,6 @@ void ResourceLoader::LoadResource(const ResourceRequest& request)
   mImpl->LoadResource(request);
 }
 
-ResourcePointer ResourceLoader::LoadResourceSynchronously(const Integration::ResourceType& resourceType, const std::string& resourcePath)
-{
-  return mImpl->LoadResourceSynchronously( resourceType, resourcePath );
-}
-
 void ResourceLoader::SaveResource(const ResourceRequest& request)
 {
   mImpl->SaveResource(request);
@@ -494,27 +455,12 @@ bool ResourceLoader::IsLoading()
   return mImpl->IsLoading();
 }
 
-void ResourceLoader::GetClosestImageSize( const std::string& filename,
-                                          const ImageAttributes& attributes,
-                                          Vector2& closestSize )
-{
-  mImpl->GetClosestImageSize( filename, attributes, closestSize );
-}
-
-void ResourceLoader::GetClosestImageSize( ResourcePointer resourceBuffer,
-                                          const ImageAttributes& attributes,
-                                          Vector2& closestSize )
-{
-  mImpl->GetClosestImageSize( resourceBuffer, attributes, closestSize );
-}
-
-
-const std::string& ResourceLoader::GetFontFamilyForChars( const TextArray& charsRequested )
+const std::string& ResourceLoader::GetFontFamilyForChars( const Integration::TextArray& charsRequested )
 {
   return mImpl->mFontController->GetFontFamilyForChars( charsRequested ).first;
 }
 
-bool ResourceLoader::AllGlyphsSupported( const std::string& fontFamily, const std::string& fontStyle, const TextArray& charsRequested )
+bool ResourceLoader::AllGlyphsSupported( const std::string& fontFamily, const std::string& fontStyle, const Integration::TextArray& charsRequested )
 {
   // At this point fontFamily and fontStyle must have been validated.
 
@@ -731,8 +677,7 @@ GlyphSet* ResourceLoader::GetCachedGlyphData(const TextResourceType& textRequest
       glyphMetrics.yPosition = requestedCharacters[n].yPosition;
 
       // create a new bitmap, and copy in the data
-      BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, true) );
-      DALI_ASSERT_ALWAYS( data.length == DISTANCE_FIELD_SIZE * DISTANCE_FIELD_SIZE );
+      BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD) );
 
       // assign the data
       bitmapData->GetPackedPixelsProfile()->AssignBuffer( Pixel::A8, data.data, DISTANCE_FIELD_SIZE * DISTANCE_FIELD_SIZE, DISTANCE_FIELD_SIZE, DISTANCE_FIELD_SIZE );
@@ -914,6 +859,7 @@ Integration::BitmapPtr ResourceLoader::GetGlyphImage( FT_Library freeType, const
   if( NULL != slpFace )
   {
     image = GetGlyphBitmap( slpFace->face, character );
+    delete slpFace;
   }
 
   return image;