summaryrefslogtreecommitdiff
path: root/imageloader.c
diff options
context:
space:
mode:
Diffstat (limited to 'imageloader.c')
-rw-r--r--imageloader.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/imageloader.c b/imageloader.c
index 248ca671..24134531 100644
--- a/imageloader.c
+++ b/imageloader.c
@@ -21,22 +21,42 @@ cImage* cImageLoader::LoadLogo(const char *logo, int width, int height) {
std::string logoLower = logo;
toLowerCase(logoLower);
cString File = cString::sprintf("%s/%s.%s", *Config.logoPath, logoLower.c_str(), *logoExtension);
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog("imageloader load logo %s", *File);
+ #endif
cImage *img;
+ uint32_t tick1 = GetMsTicks();
img = imgCache.GetImage( *File, width, height );
+ uint32_t tick2 = GetMsTicks();
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" search in cache: %d ms", tick2 - tick1);
+ #endif
if( img != NULL )
return img;
+ uint32_t tick3 = GetMsTicks();
bool success = LoadImage(File);
+ uint32_t tick4 = GetMsTicks();
if( !success ) {
dsyslog("imageloader LoadLogo: %s could not be loaded", *File);
return NULL;
}
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" load file from disk: %d ms", tick4 - tick3);
+ #endif
+ uint32_t tick5 = GetMsTicks();
img = CreateImage(width, height);
+ uint32_t tick6 = GetMsTicks();
if( img == NULL )
return NULL;
- imgCache.InsertImage(img, logoLower, width, height);
+
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" scale logo: %d ms", tick6 - tick5);
+ #endif
+
+ imgCache.InsertImage(img, *File, width, height);
return img;
}
@@ -46,28 +66,61 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr
cString File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, Setup.OSDTheme, cIcon, *logoExtension);
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog("imageloader load icon %s", *File);
+ #endif
+
cImage *img;
+ uint32_t tick1 = GetMsTicks();
img = imgCache.GetImage( *File, width, height );
+ uint32_t tick2 = GetMsTicks();
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" search in cache: %d ms", tick2 - tick1);
+ #endif
if( img != NULL )
return img;
+ uint32_t tick3 = GetMsTicks();
bool success = LoadImage(File);
+ uint32_t tick4 = GetMsTicks();
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" load file from disk: %d ms", tick4 - tick3);
+ #endif
+
if( !success ) {
File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, "default", cIcon, *logoExtension);
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog("imageloader load icon %s", *File);
+ #endif
+ uint32_t tick5 = GetMsTicks();
img = imgCache.GetImage( *File, width, height );
+ uint32_t tick6 = GetMsTicks();
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" search in cache: %d ms", tick6 - tick5);
+ #endif
if( img != NULL )
return img;
+ uint32_t tick7 = GetMsTicks();
success = LoadImage(File);
+ uint32_t tick8 = GetMsTicks();
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" load file from disk: %d ms", tick8 - tick7);
+ #endif
if( !success ) {
dsyslog("imageloader LoadIcon: %s could not be loaded", *File);
return NULL;
}
}
+ uint32_t tick9 = GetMsTicks();
img = CreateImage(width, height);
+ uint32_t tick10 = GetMsTicks();
+ #ifdef DEBUGIMAGELOADTIME
+ dsyslog(" scale logo: %d ms", tick10 - tick9);
+ #endif
if( img == NULL )
return NULL;
- imgCache.InsertImage(img, cIcon, width, height);
+ imgCache.InsertImage(img, *File, width, height);
return img;
}