From 419544ff4551f4c61c8b127ab770d02c14a413af Mon Sep 17 00:00:00 2001 From: natural-law Date: Fri, 22 Oct 2010 07:51:32 +0000 Subject: [PATCH] debug --- .../platform/uphone/CCXUIImage_uphone.cpp | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/cocos2dx/platform/uphone/CCXUIImage_uphone.cpp b/cocos2dx/platform/uphone/CCXUIImage_uphone.cpp index 43f69d2709..e28148b5b9 100644 --- a/cocos2dx/platform/uphone/CCXUIImage_uphone.cpp +++ b/cocos2dx/platform/uphone/CCXUIImage_uphone.cpp @@ -119,30 +119,31 @@ bool UIImage::initWithContentsOfFile(const string &strPath, tImageFormat imageTy { bool bRet = false; - switch (imageType) - { - case kImageFormatPNG: - // use libpng load image - bRet = loadPng(strPath.c_str()); - break; - case kImageFormatJPG: - bRet = loadJpg(strPath.c_str()); - break; - default: - // unsupported image type - bRet = false; - break; - } + // attempt load image from the ResourceMap. + const TBitmap* pBmp = CCFileUtils::getBitmapByResName(strPath.c_str()); + if (pBmp) + { + initWithBitmap(pBmp); + bRet = true; + } 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; - } + // can't find in the ResourceMap,find in hardware + switch (imageType) + { + case kImageFormatPNG: + // use libpng load image + bRet = loadPng(strPath.c_str()); + break; + case kImageFormatJPG: + bRet = loadJpg(strPath.c_str()); + break; + default: + // unsupported image type + bRet = false; + break; + } } return bRet;