mirror of https://github.com/axmolengine/axmol.git
debug
This commit is contained in:
parent
1d8b5d02a3
commit
419544ff45
|
@ -119,30 +119,31 @@ bool UIImage::initWithContentsOfFile(const string &strPath, tImageFormat imageTy
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
|
|
||||||
switch (imageType)
|
// attempt load image from the ResourceMap.
|
||||||
{
|
const TBitmap* pBmp = CCFileUtils::getBitmapByResName(strPath.c_str());
|
||||||
case kImageFormatPNG:
|
if (pBmp)
|
||||||
// use libpng load image
|
{
|
||||||
bRet = loadPng(strPath.c_str());
|
initWithBitmap(pBmp);
|
||||||
break;
|
bRet = true;
|
||||||
case kImageFormatJPG:
|
}
|
||||||
bRet = loadJpg(strPath.c_str());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// unsupported image type
|
|
||||||
bRet = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bRet)
|
if (!bRet)
|
||||||
{
|
{
|
||||||
// attempt load image from the ResourceMap when can't find the image file.
|
// can't find in the ResourceMap,find in hardware
|
||||||
const TBitmap* pBmp = CCFileUtils::getBitmapByResName(strPath.c_str());
|
switch (imageType)
|
||||||
if (pBmp)
|
{
|
||||||
{
|
case kImageFormatPNG:
|
||||||
initWithBitmap(pBmp);
|
// use libpng load image
|
||||||
bRet = true;
|
bRet = loadPng(strPath.c_str());
|
||||||
}
|
break;
|
||||||
|
case kImageFormatJPG:
|
||||||
|
bRet = loadJpg(strPath.c_str());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// unsupported image type
|
||||||
|
bRet = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bRet;
|
return bRet;
|
||||||
|
|
Loading…
Reference in New Issue