Jeck - Extremely minor speedup for cache access in GameStateDeckViewer, minor fix to WResourceManager::cleanup().

This commit is contained in:
wagic.jeck
2009-09-11 08:17:05 +00:00
parent 421d2655ee
commit 9d203619aa
3 changed files with 12 additions and 8 deletions
-1
View File
@@ -80,7 +80,6 @@ public:
WResourceManager(); WResourceManager();
~WResourceManager(); ~WResourceManager();
bool isCardInCache(MTGCard * card, int type = CACHE_CARD);
JQuad * RetrieveCard(MTGCard * card, int type = CACHE_CARD, int style = RETRIEVE_NORMAL); JQuad * RetrieveCard(MTGCard * card, int type = CACHE_CARD, int style = RETRIEVE_NORMAL);
JSample * RetrieveSample(string filename, int style = RETRIEVE_NORMAL); JSample * RetrieveSample(string filename, int style = RETRIEVE_NORMAL);
JTexture * RetrieveTexture(string filename, int style = RETRIEVE_NORMAL); JTexture * RetrieveTexture(string filename, int style = RETRIEVE_NORMAL);
+10 -5
View File
@@ -543,12 +543,17 @@ void GameStateDeckViewer::renderCard(int id, float rotation){
int alpha = (int) (255 * (scale + 1.0 - max_scale)); int alpha = (int) (255 * (scale + 1.0 - max_scale));
if (!card) return; if (!card) return;
JQuad * quad = backQuad; JQuad * quad = NULL;
int showName = 1; int showName = 0;
if (resources.RetrieveCard(card,CACHE_CARD,RETRIEVE_EXISTING) || last_user_activity > (abs(2-id) + 1)* NO_USER_ACTIVITY_SHOWCARD_DELAY){ quad = resources.RetrieveCard(card,CACHE_CARD,RETRIEVE_EXISTING);
quad = resources.RetrieveCard(card); if (!quad){
showName = 0; if(last_user_activity > (abs(2-id) + 1)* NO_USER_ACTIVITY_SHOWCARD_DELAY)
quad = resources.RetrieveCard(card);
else{
quad = backQuad;
showName = 1;
}
} }
+1 -1
View File
@@ -163,8 +163,8 @@ bool WResourceManager::cleanup(){
long maxSize = options[Options::CACHESIZE].number * 100000; long maxSize = options[Options::CACHESIZE].number * 100000;
if (!maxSize) maxSize = CACHE_SIZE_PIXELS; if (!maxSize) maxSize = CACHE_SIZE_PIXELS;
ClearMisses();
while (textureCache.size() > MAX_CACHE_OBJECTS - 1 || totalsize > maxSize){ while (textureCache.size() > MAX_CACHE_OBJECTS - 1 || totalsize > maxSize){
ClearMisses();
int result = RemoveOldestTexture(); int result = RemoveOldestTexture();
if (!result) return false; if (!result) return false;
} }