Three improvements involving image caching:

1) prevent the textureQuad map from containing references to cards when we're returning a temp (card backdrop) image in the threaded version.
2) we had two copies of the pspicon image in the cache (ie the regular & managed).  Changed the reference in the DeckMenu code to use the managed instance.
3) Fixed a problem with a default constructor param that would set RESOURCE_LOCKED on certain images.  I noticed that the 'NEW' image was locking itself in the cache because no resource modes was being passed in, so the default constructor param was setting it to locked.  This seems like a bad idea - if you're not explicitly locking a resource in the call, that shouldn't be the default behaviour.

Also added an assert safeguard to catch the possibility of 'overlocking' an image resource, as this probably means the image fetching routine is being abused somehow.
This commit is contained in:
wrenczes@gmail.com
2011-07-07 07:37:17 +00:00
parent 93d96fe52b
commit c5963c3c23
4 changed files with 22 additions and 7 deletions

View File

@@ -8,6 +8,9 @@
const std::string kGenericCardID = "back";
const std::string kGenericCardThumbnailID = "back_thumb";
const std::string kGenericCard("back.jpg");
const std::string kGenericThumbCard("back_thumb.jpg");
enum ENUM_WRES_INFO
{
WRES_UNLOCKED = 0, //Resource is unlocked.
@@ -74,7 +77,7 @@ public:
virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0;
virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0) = 0;
virtual JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL, int id = 0) = 0;
virtual JQuadPtr RetrieveTempQuad(const string& filename, int submode = CACHE_NORMAL) = 0;
virtual hgeParticleSystemInfo * RetrievePSI(const string& filename, JQuad * texture, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual int RetrieveError() = 0;