X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-url.cpp;h=0ad5778fb0b589ec03e2ecfb0cb213bab7cb07cf;hp=70c6dc23abdf5c6e710dbddd8618900398361879;hb=8362296c1a4926b2a041b75537766977b064b62e;hpb=311e5010e011ee0b93a4a7ee48a7ae150cdc0dbd diff --git a/dali-toolkit/internal/visuals/visual-url.cpp b/dali-toolkit/internal/visuals/visual-url.cpp index 70c6dc2..0ad5778 100644 --- a/dali-toolkit/internal/visuals/visual-url.cpp +++ b/dali-toolkit/internal/visuals/visual-url.cpp @@ -20,10 +20,6 @@ // EXTERNAL HEADERS #include // for toupper() -// INTERNAL HEADERS -#include -#include - namespace Dali { namespace Toolkit @@ -122,7 +118,9 @@ VisualUrl::Type ResolveType(const std::string& url) char GIF[4] = {'f', 'i', 'g', '.'}; 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 jsonScore = 0; @@ -139,6 +137,14 @@ VisualUrl::Type ResolveType(const std::string& url) return VisualUrl::SVG; } } + if((offsetFromEnd < sizeof(TVG)) && (currentChar == TVG[offsetFromEnd])) + { + // early out if TVG as can't be used in N patch for now + if(++tvgScore == sizeof(TVG)) + { + return VisualUrl::TVG; + } + } if((offsetFromEnd < sizeof(GIF)) && (currentChar == GIF[offsetFromEnd])) { // early out if GIF 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; }