Add animated vector image visual
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-url.cpp
index 907b428..731ed20 100644 (file)
@@ -99,8 +99,10 @@ VisualUrl::Type ResolveType( const std::string& url )
     enum { SUFFIX, HASH, HASH_DOT } state = SUFFIX;
     char SVG[ 4 ] = { 'g', 'v', 's', '.' };
     char GIF[ 4 ] = { 'f', 'i', 'g', '.' };
+    char JSON[ 5 ] = { 'n', 'o', 's', 'j', '.' };
     unsigned int svgScore = 0;
     unsigned int gifScore = 0;
+    unsigned int jsonScore = 0;
     int index = count;
     while( --index >= 0 )
     {
@@ -122,6 +124,14 @@ VisualUrl::Type ResolveType( const std::string& url )
           return VisualUrl::GIF;
         }
       }
+      if( ( offsetFromEnd < sizeof(JSON) )&&( currentChar == JSON[ offsetFromEnd ] ) )
+      {
+        // early out if JSON as can't be used in N patch for now
+        if( ++jsonScore == sizeof(JSON) )
+        {
+          return VisualUrl::JSON;
+        }
+      }
       switch( state )
       {
         case SUFFIX:
@@ -234,7 +244,7 @@ bool VisualUrl::IsLocalResource() const
   return mLocation == VisualUrl::LOCAL;
 }
 
-std::string VisualUrl::GetLocation()
+std::string VisualUrl::GetLocation() const
 {
   const auto location = mUrl.find( "://" );
   if( std::string::npos != location )