[Tizen] Fix svg memory issue
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / svg / svg-rasterize-thread.cpp
index 7cb6734..174183e 100644 (file)
@@ -35,7 +35,11 @@ namespace Toolkit
 
 namespace Internal
 {
+
+namespace
+{
 const char * const UNITS("px");
+}
 
 RasterizingTask::RasterizingTask( SvgVisual* svgRenderer, NSVGimage* parsedSvg, const VisualUrl& url, float dpi, unsigned int width, unsigned int height)
 : mSvgVisual( svgRenderer ),
@@ -54,18 +58,7 @@ void RasterizingTask::Load()
     return;
   }
 
-  if( mUrl.IsLocalResource() )
-  {
-    Dali::Vector<char> buffer;
-    if ( !Dali::FileLoader::ReadFile( mUrl.GetUrl(), buffer ) )
-    {
-      DALI_LOG_ERROR("Failed to read file!\n");
-      return;
-    }
-
-    mParsedSvg = nsvgParse( buffer.begin(), UNITS, mDpi );
-  }
-  else
+  if( !mUrl.IsLocalResource() )
   {
     Dali::Vector<uint8_t> remoteBuffer;
 
@@ -75,6 +68,7 @@ void RasterizingTask::Load()
       return;
     }
 
+    remoteBuffer.PushBack( '\0' );
     mParsedSvg = nsvgParse( reinterpret_cast<char*>(remoteBuffer.begin()), UNITS, mDpi );
   }
 }