You've already forked emulationstation-next
mirror of
https://github.com/archr-linux/emulationstation-next.git
synced 2026-07-13 03:19:12 -07:00
Small optimizations
This commit is contained in:
@@ -209,6 +209,14 @@ ImageGridComponent<T>::ImageGridComponent(Window* window) : IList<ImageGridData,
|
||||
template<typename T>
|
||||
void ImageGridComponent<T>::add(const std::string& name, const std::string& imagePath, const std::string& videoPath, const std::string& marqueePath, bool favorite, bool cheevos, bool folder, bool virtualFolder, const T& obj)
|
||||
{
|
||||
// If file system is not yet cached, it will introduce lags later ( during animations mainly ). Manage it now.
|
||||
if (mEntries.size() < 16)
|
||||
{
|
||||
Utils::FileSystem::exists(imagePath);
|
||||
Utils::FileSystem::exists(videoPath);
|
||||
Utils::FileSystem::exists(marqueePath);
|
||||
}
|
||||
|
||||
typename IList<ImageGridData, T>::Entry entry;
|
||||
entry.name = name;
|
||||
entry.object = obj;
|
||||
|
||||
@@ -125,6 +125,9 @@ ResourceData ResourceManager::loadFile(const std::string& path, size_t size) con
|
||||
|
||||
bool ResourceManager::fileExists(const std::string& path) const
|
||||
{
|
||||
if (path[0] != ':' && path[0] != '~' && path[0] != '/')
|
||||
return Utils::FileSystem::exists(path);
|
||||
|
||||
//if it exists as a resource file, return true
|
||||
if(getResourcePath(path) != path)
|
||||
return true;
|
||||
|
||||
Vendored
+23
-7
@@ -215,17 +215,17 @@ void nsvgDelete(NSVGimage* image);
|
||||
#endif
|
||||
|
||||
|
||||
static int nsvg__isspace(char c)
|
||||
inline static int nsvg__isspace(char c)
|
||||
{
|
||||
return strchr(" \t\n\v\f\r", c) != 0;
|
||||
}
|
||||
|
||||
static int nsvg__isdigit(char c)
|
||||
inline static int nsvg__isdigit(char c)
|
||||
{
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
static int nsvg__isnum(char c)
|
||||
inline static int nsvg__isnum(char c)
|
||||
{
|
||||
return strchr("0123456789+-.eE", c) != 0;
|
||||
}
|
||||
@@ -1100,9 +1100,17 @@ static double nsvg__atof(const char* s)
|
||||
}
|
||||
|
||||
// Parse integer part
|
||||
if (nsvg__isdigit(*cur)) {
|
||||
if (nsvg__isdigit(*cur))
|
||||
{
|
||||
end = cur;
|
||||
for (; *end && *end >= '0' && *end <= '9'; end++)
|
||||
{
|
||||
intPart *= 10;
|
||||
intPart += *end - '0';
|
||||
}
|
||||
|
||||
// Parse digit sequence
|
||||
intPart = strtoll(cur, &end, 10);
|
||||
// intPart = strtoll(cur, &end, 10);
|
||||
if (cur != end) {
|
||||
res = (double)intPart;
|
||||
hasIntPart = 1;
|
||||
@@ -1113,9 +1121,17 @@ static double nsvg__atof(const char* s)
|
||||
// Parse fractional part.
|
||||
if (*cur == '.') {
|
||||
cur++; // Skip '.'
|
||||
if (nsvg__isdigit(*cur)) {
|
||||
if (nsvg__isdigit(*cur))
|
||||
{
|
||||
end = cur;
|
||||
for (; *end && *end >= '0' && *end <= '9'; end++)
|
||||
{
|
||||
fracPart *= 10;
|
||||
fracPart += *end - '0';
|
||||
}
|
||||
|
||||
// Parse digit sequence
|
||||
fracPart = strtoll(cur, &end, 10);
|
||||
//fracPart = strtoll(cur, &end, 10);
|
||||
if (cur != end) {
|
||||
res += (double)fracPart / pow(10.0, (double)(end - cur));
|
||||
hasFracPart = 1;
|
||||
|
||||
Vendored
+3
-3
@@ -328,7 +328,7 @@ static float nsvg__normalize(float *x, float* y)
|
||||
return d;
|
||||
}
|
||||
|
||||
static float nsvg__absf(float x) { return x < 0 ? -x : x; }
|
||||
inline static float nsvg__absf(float x) { return x < 0 ? -x : x; }
|
||||
|
||||
static void nsvg__flattenCubicBez(NSVGrasterizer* r,
|
||||
float x1, float y1, float x2, float y2,
|
||||
@@ -952,9 +952,9 @@ static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEd
|
||||
}
|
||||
}
|
||||
|
||||
static float nsvg__clampf(float a, float mn, float mx) { return a < mn ? mn : (a > mx ? mx : a); }
|
||||
inline static float nsvg__clampf(float a, float mn, float mx) { return a < mn ? mn : (a > mx ? mx : a); }
|
||||
|
||||
static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
inline static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
{
|
||||
return (r) | (g << 8) | (b << 16) | (a << 24);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user