Delay writing image cache index until after load complete
While loading all songs, disable writing the index file for the image cache, in order to speed up loading and cache generation, similar to how the song cache index file write is delayed.
This commit is contained in:
+9
-1
@@ -169,6 +169,7 @@ void ImageCache::UnloadAllImages()
|
||||
}
|
||||
|
||||
ImageCache::ImageCache()
|
||||
: delay_save_cache(false)
|
||||
{
|
||||
ReadFromDisk();
|
||||
}
|
||||
@@ -457,9 +458,16 @@ void ImageCache::CacheImageInternal( RString sImageDir, RString sImagePath )
|
||||
ImageData.SetValue( sImagePath, "Width", iSourceWidth );
|
||||
ImageData.SetValue( sImagePath, "Height", iSourceHeight );
|
||||
ImageData.SetValue( sImagePath, "FullHash", GetHashForFile( sImagePath ) );
|
||||
ImageData.WriteFile( IMAGE_CACHE_INDEX );
|
||||
if (!delay_save_cache)
|
||||
WriteToDisk();
|
||||
}
|
||||
|
||||
void ImageCache::WriteToDisk()
|
||||
{
|
||||
ImageData.WriteFile(IMAGE_CACHE_INDEX);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2003 Glenn Maynard
|
||||
* All rights reserved.
|
||||
|
||||
Reference in New Issue
Block a user