[Tizen] Make do not support animated webp
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-url.cpp
index 70c6dc2..e8700cb 100644 (file)
 // EXTERNAL HEADERS
 #include <cstring> // for toupper()
 
-// INTERNAL HEADERS
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-
 namespace Dali
 {
 namespace Toolkit
@@ -120,11 +116,13 @@ VisualUrl::Type ResolveType(const std::string& url)
     } state                = SUFFIX;
     char         SVG[4]    = {'g', 'v', 's', '.'};
     char         GIF[4]    = {'f', 'i', 'g', '.'};
-    char         WEBP[5]   = {'p', 'b', 'e', 'w', '.'};
+    //char         WEBP[5]   = {'p', 'b', 'e', 'w', '.'};
     char         JSON[5]   = {'n', 'o', 's', 'j', '.'};
+    char         TVG[4]    = {'g', 'v', 't', '.'};
     unsigned int svgScore  = 0;
+    unsigned int tvgScore  = 0;
     unsigned int gifScore  = 0;
-    unsigned int webpScore = 0;
+    //unsigned int webpScore = 0;
     unsigned int jsonScore = 0;
     int          index     = count;
     while(--index >= 0)
@@ -139,22 +137,30 @@ VisualUrl::Type ResolveType(const std::string& url)
           return VisualUrl::SVG;
         }
       }
-      if((offsetFromEnd < sizeof(GIF)) && (currentChar == GIF[offsetFromEnd]))
+      if((offsetFromEnd < sizeof(TVG)) && (currentChar == TVG[offsetFromEnd]))
       {
-        // early out if GIF as can't be used in N patch for now
-        if(++gifScore == sizeof(GIF))
+        // early out if TVG as can't be used in N patch for now
+        if(++tvgScore == sizeof(TVG))
         {
-          return VisualUrl::GIF;
+          return VisualUrl::TVG;
         }
       }
-      if((offsetFromEnd < sizeof(WEBP)) && (currentChar == WEBP[offsetFromEnd]))
+      if((offsetFromEnd < sizeof(GIF)) && (currentChar == GIF[offsetFromEnd]))
       {
-        // early out if WEBP as can't be used in N patch for now
-        if(++webpScore == sizeof(WEBP))
+        // early out if GIF as can't be used in N patch for now
+        if(++gifScore == sizeof(GIF))
         {
-          return VisualUrl::WEBP;
+          return VisualUrl::GIF;
         }
       }
+      //if((offsetFromEnd < sizeof(WEBP)) && (currentChar == WEBP[offsetFromEnd]))
+      //{
+      //  // early out if WEBP as can't be used in N patch for now
+      //  if(++webpScore == sizeof(WEBP))
+      //  {
+      //    return VisualUrl::WEBP;
+      //  }
+      //}
       if((offsetFromEnd < sizeof(JSON)) && (currentChar == JSON[offsetFromEnd]))
       {
         // early out if JSON as can't be used in N patch for now
@@ -228,14 +234,6 @@ VisualUrl::VisualUrl(const std::string& url)
       // TEXTURE and BUFFER location url doesn't need type resolving, REGULAR_IMAGE is fine
       mType = ResolveType(url);
     }
-    else
-    {
-      Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
-      if(factory)
-      {
-        GetImplementation(factory).GetTextureManager().UseExternalResource(*this);
-      }
-    }
   }
 }
 
@@ -244,69 +242,19 @@ VisualUrl::VisualUrl(const VisualUrl& url)
   mType(url.mType),
   mLocation(url.mLocation)
 {
-  if(VisualUrl::TEXTURE == mLocation || VisualUrl::BUFFER == mLocation)
-  {
-    Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
-    if(factory)
-    {
-      GetImplementation(factory).GetTextureManager().UseExternalResource(*this);
-    }
-  }
 }
 
 VisualUrl::~VisualUrl()
 {
-  if(VisualUrl::TEXTURE == mLocation)
-  {
-    Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
-    if(factory)
-    {
-      GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
-    }
-  }
-  else if(VisualUrl::BUFFER == mLocation)
-  {
-    Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
-    if(factory)
-    {
-      GetImplementation(factory).GetTextureManager().RemoveExternalEncodedImageBuffer(mUrl);
-    }
-  }
 }
 
 VisualUrl& VisualUrl::operator=(const VisualUrl& url)
 {
   if(&url != this)
   {
-    if(VisualUrl::TEXTURE == mLocation)
-    {
-      Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
-      if(factory)
-      {
-        GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
-      }
-    }
-    else if(VisualUrl::BUFFER == mLocation)
-    {
-      Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
-      if(factory)
-      {
-        GetImplementation(factory).GetTextureManager().RemoveExternalEncodedImageBuffer(mUrl);
-      }
-    }
-
     mUrl      = url.mUrl;
     mType     = url.mType;
     mLocation = url.mLocation;
-
-    if(VisualUrl::TEXTURE == mLocation || VisualUrl::BUFFER == mLocation)
-    {
-      Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
-      if(factory)
-      {
-        GetImplementation(factory).GetTextureManager().UseExternalResource(*this);
-      }
-    }
   }
   return *this;
 }