projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add support for text geometry" into devel/master
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
visuals
/
visual-url.cpp
diff --git
a/dali-toolkit/internal/visuals/visual-url.cpp
b/dali-toolkit/internal/visuals/visual-url.cpp
index
1979f78
..
0ad5778
100644
(file)
--- a/
dali-toolkit/internal/visuals/visual-url.cpp
+++ b/
dali-toolkit/internal/visuals/visual-url.cpp
@@
-20,10
+20,6
@@
// EXTERNAL HEADERS
#include <cstring> // for toupper()
// 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
namespace Dali
{
namespace Toolkit
@@
-38,15
+34,28
@@
VisualUrl::ProtocolType ResolveLocation(const std::string& url)
const uint32_t length = url.size();
if((length > 7) && urlCStr[5] == ':' && urlCStr[6] == '/' && urlCStr[7] == '/')
{
const uint32_t length = url.size();
if((length > 7) && urlCStr[5] == ':' && urlCStr[6] == '/' && urlCStr[7] == '/')
{
- // https://
- if(('h' == tolower(urlCStr[0])) &&
- ('t' == tolower(urlCStr[1])) &&
- ('t' == tolower(urlCStr[2])) &&
- ('p' == tolower(urlCStr[3])) &&
- ('s' == tolower(urlCStr[4])))
+ // https:// or enbuf://
+ const char hOre = tolower(urlCStr[0]);
+ const char tOrn = tolower(urlCStr[1]);
+ const char tOrb = tolower(urlCStr[2]);
+ const char pOru = tolower(urlCStr[3]);
+ const char sOrf = tolower(urlCStr[4]);
+ if(('h' == hOre) &&
+ ('t' == tOrn) &&
+ ('t' == tOrb) &&
+ ('p' == pOru) &&
+ ('s' == sOrf))
{
return VisualUrl::REMOTE;
}
{
return VisualUrl::REMOTE;
}
+ if(('e' == hOre) &&
+ ('n' == tOrn) &&
+ ('b' == tOrb) &&
+ ('u' == pOru) &&
+ ('f' == sOrf))
+ {
+ return VisualUrl::BUFFER;
+ }
}
else if((length > 6) && urlCStr[4] == ':' && urlCStr[5] == '/' && urlCStr[6] == '/')
{
}
else if((length > 6) && urlCStr[4] == ':' && urlCStr[5] == '/' && urlCStr[6] == '/')
{
@@
-73,18
+82,20
@@
VisualUrl::ProtocolType ResolveLocation(const std::string& url)
else if((length > 5) && urlCStr[3] == ':' && urlCStr[4] == '/' && urlCStr[5] == '/')
{
// ftp:// or ssh://
else if((length > 5) && urlCStr[3] == ':' && urlCStr[4] == '/' && urlCStr[5] == '/')
{
// ftp:// or ssh://
- const char fOrS = tolower(urlCStr[0]);
- if(('f' == fOrS) || ('s' == fOrS))
+ const char fOrs = tolower(urlCStr[0]);
+ const char tOrs = tolower(urlCStr[1]);
+ const char pOrh = tolower(urlCStr[2]);
+ if(('f' == fOrs) &&
+ ('t' == tOrs) &&
+ ('p' == pOrh))
{
{
- const char tOrs = tolower(urlCStr[1]);
- if(('t' == tOrs) || ('s' == tOrs))
- {
- const char pOrh = tolower(urlCStr[2]);
- if(('p' == pOrh) || ('h' == pOrh))
- {
- return VisualUrl::REMOTE;
- }
- }
+ return VisualUrl::REMOTE;
+ }
+ if(('s' == fOrs) &&
+ ('s' == tOrs) &&
+ ('h' == pOrh))
+ {
+ return VisualUrl::REMOTE;
}
}
return VisualUrl::LOCAL;
}
}
return VisualUrl::LOCAL;
@@
-107,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 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 svgScore = 0;
+ unsigned int tvgScore = 0;
unsigned int gifScore = 0;
unsigned int webpScore = 0;
unsigned int jsonScore = 0;
unsigned int gifScore = 0;
unsigned int webpScore = 0;
unsigned int jsonScore = 0;
@@
-124,6
+137,14
@@
VisualUrl::Type ResolveType(const std::string& url)
return VisualUrl::SVG;
}
}
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
if((offsetFromEnd < sizeof(GIF)) && (currentChar == GIF[offsetFromEnd]))
{
// early out if GIF as can't be used in N patch for now
@@
-208,19
+229,11
@@
VisualUrl::VisualUrl(const std::string& url)
if(!url.empty())
{
mLocation = ResolveLocation(url);
if(!url.empty())
{
mLocation = ResolveLocation(url);
- if(VisualUrl::TEXTURE != mLocation)
+ if(VisualUrl::TEXTURE != mLocation
&& VisualUrl::BUFFER != mLocation
)
{
{
- // TEXTURE location url doesn't need type resolving, REGULAR_IMAGE is fine
+ // TEXTURE
and BUFFER
location url doesn't need type resolving, REGULAR_IMAGE is fine
mType = ResolveType(url);
}
mType = ResolveType(url);
}
- else
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
- }
- }
}
}
}
}
@@
-229,53
+242,19
@@
VisualUrl::VisualUrl(const VisualUrl& url)
mType(url.mType),
mLocation(url.mLocation)
{
mType(url.mType),
mLocation(url.mLocation)
{
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
- }
- }
}
VisualUrl::~VisualUrl()
{
}
VisualUrl::~VisualUrl()
{
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
- }
- }
}
VisualUrl& VisualUrl::operator=(const VisualUrl& url)
{
if(&url != this)
{
}
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);
- }
- }
-
mUrl = url.mUrl;
mType = url.mType;
mLocation = url.mLocation;
mUrl = url.mUrl;
mType = url.mType;
mLocation = url.mLocation;
-
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
- }
- }
}
return *this;
}
}
return *this;
}
@@
-305,6
+284,11
@@
bool VisualUrl::IsLocalResource() const
return mLocation == VisualUrl::LOCAL;
}
return mLocation == VisualUrl::LOCAL;
}
+bool VisualUrl::IsBufferResource() const
+{
+ return mLocation == VisualUrl::BUFFER;
+}
+
std::string VisualUrl::GetLocation() const
{
return GetLocation(mUrl);
std::string VisualUrl::GetLocation() const
{
return GetLocation(mUrl);
@@
-315,6
+299,11
@@
std::string VisualUrl::CreateTextureUrl(const std::string& location)
return "dali://" + location;
}
return "dali://" + location;
}
+std::string VisualUrl::CreateBufferUrl(const std::string& location)
+{
+ return "enbuf://" + location;
+}
+
VisualUrl::ProtocolType VisualUrl::GetProtocolType(const std::string& url)
{
return ResolveLocation(url);
VisualUrl::ProtocolType VisualUrl::GetProtocolType(const std::string& url)
{
return ResolveLocation(url);
@@
-330,7
+319,6
@@
std::string VisualUrl::GetLocation(const std::string& url)
return url;
}
return url;
}
-
} // namespace Internal
} // namespace Toolkit
} // namespace Internal
} // namespace Toolkit