common loader: lookup in the numberic order.

This commit is contained in:
Hermet Park 2021-07-30 12:34:56 +09:00
parent b72ff371ee
commit b3aed50a2e
2 changed files with 17 additions and 17 deletions

View file

@ -46,15 +46,15 @@
static LoadModule* _find(FileType type) static LoadModule* _find(FileType type)
{ {
switch(type) { switch(type) {
case FileType::Svg: { case FileType::Tvg: {
#ifdef THORVG_SVG_LOADER_SUPPORT #ifdef THORVG_TVG_LOADER_SUPPORT
return new SvgLoader; return new TvgLoader;
#endif #endif
break; break;
} }
case FileType::Png: { case FileType::Svg: {
#ifdef THORVG_PNG_LOADER_SUPPORT #ifdef THORVG_SVG_LOADER_SUPPORT
return new PngLoader; return new SvgLoader;
#endif #endif
break; break;
} }
@ -62,9 +62,9 @@ static LoadModule* _find(FileType type)
return new RawLoader; return new RawLoader;
break; break;
} }
case FileType::Tvg: { case FileType::Png: {
#ifdef THORVG_TVG_LOADER_SUPPORT #ifdef THORVG_PNG_LOADER_SUPPORT
return new TvgLoader; return new PngLoader;
#endif #endif
break; break;
} }
@ -82,20 +82,20 @@ static LoadModule* _find(FileType type)
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
const char *format; const char *format;
switch(type) { switch(type) {
case FileType::Svg: { case FileType::Tvg: {
format = "SVG"; format = "TVG";
break; break;
} }
case FileType::Png: { case FileType::Svg: {
format = "PNG"; format = "SVG";
break; break;
} }
case FileType::Raw: { case FileType::Raw: {
format = "RAW"; format = "RAW";
break; break;
} }
case FileType::Tvg: { case FileType::Png: {
format = "TVG"; format = "PNG";
break; break;
} }
case FileType::Jpg: { case FileType::Jpg: {
@ -116,9 +116,9 @@ static LoadModule* _find(FileType type)
static LoadModule* _find(const string& path) static LoadModule* _find(const string& path)
{ {
auto ext = path.substr(path.find_last_of(".") + 1); auto ext = path.substr(path.find_last_of(".") + 1);
if (!ext.compare("tvg")) return _find(FileType::Tvg);
if (!ext.compare("svg")) return _find(FileType::Svg); if (!ext.compare("svg")) return _find(FileType::Svg);
if (!ext.compare("png")) return _find(FileType::Png); if (!ext.compare("png")) return _find(FileType::Png);
if (!ext.compare("tvg")) return _find(FileType::Tvg);
if (!ext.compare("jpg")) return _find(FileType::Jpg); if (!ext.compare("jpg")) return _find(FileType::Jpg);
return nullptr; return nullptr;
} }