Skip to content

Commit

Permalink
Merge pull request #62 from Jousway/imagecache
Browse files Browse the repository at this point in the history
Changing BannerCache into ImageCache
  • Loading branch information
nico-abram authored Dec 10, 2017
2 parents 555a283 + f7c8da3 commit 1fa09ea
Show file tree
Hide file tree
Showing 19 changed files with 305 additions and 231 deletions.
5 changes: 5 additions & 0 deletions Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ OverlayScreens="ScreenSystemLayer,ScreenSyncOverlay,ScreenStatsOverlay,ScreenDeb
# Used in PlayerStageStats for formatting scores.
PercentScoreDecimalPlaces=2

# We want to define which Images to cache.
# Predefined Images include: Banner,Background,CDTitle,Jacket,CDImage,Disc
# Is Case Sensitive
ImageCache="Banner"

# 02 #

[LightsManager]
Expand Down
6 changes: 3 additions & 3 deletions src/Banner.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "global.h"
#include "Banner.h"
#include "BannerCache.h"
#include "ImageCache.h"
#include "SongManager.h"
#include "RageUtil.h"
#include "Song.h"
Expand Down Expand Up @@ -55,15 +55,15 @@ void Banner::LoadFromCachedBanner( const RString &sPath )
}

RageTextureID ID;
bool bLowRes = (PREFSMAN->m_BannerCache != BNCACHE_FULL);
bool bLowRes = (PREFSMAN->m_ImageCache != IMGCACHE_FULL);
if( !bLowRes )
{
ID = Sprite::SongBannerTexture( sPath );
}
else
{
// Try to load the low quality version.
ID = BANNERCACHE->LoadCachedBanner( sPath );
ID = IMAGECACHE->LoadCachedImage( "Banner", sPath );
}

if( TEXTUREMAN->IsTextureRegistered(ID) )
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeData-data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ list(APPEND SM_DATA_REST_SRC
"AdjustSync.cpp"
"AutoKeysounds.cpp"
"BackgroundUtil.cpp"
"BannerCache.cpp"
"ImageCache.cpp"
"Character.cpp"
"CodeDetector.cpp"
"CodeSet.cpp"
Expand Down Expand Up @@ -185,7 +185,7 @@ list(APPEND SM_DATA_REST_HPP
"AdjustSync.h"
"AutoKeysounds.h"
"BackgroundUtil.h"
"BannerCache.h"
"ImageCache.h"
"Character.h"
"CodeDetector.h"
"CodeSet.h"
Expand Down
1 change: 1 addition & 0 deletions src/CommonMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ThemeMetricDifficultiesToShow CommonMetrics::DIFFICULTIES_TO_SHOW ("Common","Di
ThemeMetricStepsTypesToShow CommonMetrics::STEPS_TYPES_TO_SHOW ("Common","StepsTypesToHide");
ThemeMetric<bool> CommonMetrics::AUTO_SET_STYLE ("Common","AutoSetStyle");
ThemeMetric<int> CommonMetrics::PERCENT_SCORE_DECIMAL_PLACES ("Common","PercentScoreDecimalPlaces");
ThemeMetric<RString> CommonMetrics::IMAGES_TO_CACHE ("Common","ImageCache");

ThemeMetricDifficultiesToShow::ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ) :
ThemeMetric<RString>(sGroup,sName)
Expand Down
2 changes: 2 additions & 0 deletions src/CommonMetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ namespace CommonMetrics
extern ThemeMetric<bool> AUTO_SET_STYLE;
/** @brief How many decimal places are used? */
extern ThemeMetric<int> PERCENT_SCORE_DECIMAL_PLACES;

extern ThemeMetric<RString> IMAGES_TO_CACHE;

RString LocalizeOptionItem( const RString &s, bool bOptional );
};
Expand Down
6 changes: 3 additions & 3 deletions src/FadingBanner.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "global.h"
#include "FadingBanner.h"
#include "RageTextureManager.h"
#include "BannerCache.h"
#include "ImageCache.h"
#include "Song.h"
#include "RageLog.h"
#include "PrefsManager.h"
Expand Down Expand Up @@ -128,15 +128,15 @@ bool FadingBanner::LoadFromCachedBanner( const RString &path )
* which will cause the fade-in to be further delayed. */

RageTextureID ID;
bool bLowRes = (PREFSMAN->m_BannerCache != BNCACHE_FULL);
bool bLowRes = (PREFSMAN->m_ImageCache != IMGCACHE_FULL);
if( !bLowRes )
{
ID = Sprite::SongBannerTexture( path );
}
else
{
// Try to load the low quality version.
ID = BANNERCACHE->LoadCachedBanner( path );
ID = IMAGECACHE->LoadCachedImage( "Banner", path );
}

if( !TEXTUREMAN->IsTextureRegistered(ID) )
Expand Down
Loading

0 comments on commit 1fa09ea

Please sign in to comment.