This commit is contained in:
natural-law 2010-10-22 07:51:32 +00:00
parent 1d8b5d02a3
commit 419544ff45
1 changed files with 22 additions and 21 deletions

View File

@ -119,6 +119,17 @@ bool UIImage::initWithContentsOfFile(const string &strPath, tImageFormat imageTy
{ {
bool bRet = false; bool bRet = false;
// attempt load image from the ResourceMap.
const TBitmap* pBmp = CCFileUtils::getBitmapByResName(strPath.c_str());
if (pBmp)
{
initWithBitmap(pBmp);
bRet = true;
}
if (!bRet)
{
// can't find in the ResourceMap,find in hardware
switch (imageType) switch (imageType)
{ {
case kImageFormatPNG: case kImageFormatPNG:
@ -133,16 +144,6 @@ bool UIImage::initWithContentsOfFile(const string &strPath, tImageFormat imageTy
bRet = false; bRet = false;
break; break;
} }
if (!bRet)
{
// attempt load image from the ResourceMap when can't find the image file.
const TBitmap* pBmp = CCFileUtils::getBitmapByResName(strPath.c_str());
if (pBmp)
{
initWithBitmap(pBmp);
bRet = true;
}
} }
return bRet; return bRet;