Jeck - Extremely minor speedup for cache access in GameStateDeckViewer, minor fix to WResourceManager::cleanup().
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -543,13 +543,18 @@ 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (quad){
|
if (quad){
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user