From 6c69626a4f53f734c09fb61d4f4727d3bae9c7e7 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 27 Jan 2014 10:31:24 +0800 Subject: [PATCH] closed #3867: "Testing empty labels" in LabelTest crashes on Linux platform. --- cocos/2d/platform/linux/CCImage.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/cocos/2d/platform/linux/CCImage.cpp b/cocos/2d/platform/linux/CCImage.cpp index 0d53db0c19..9e1579f304 100644 --- a/cocos/2d/platform/linux/CCImage.cpp +++ b/cocos/2d/platform/linux/CCImage.cpp @@ -450,23 +450,21 @@ static BitmapDC& sharedBitmapDC() } bool Image::initWithString( - const char * pText, - int nWidth/* = 0*/, - int nHeight/* = 0*/, - TextAlign eAlignMask/* = kAlignCenter*/, - const char * pFontName/* = nil*/, - int nSize/* = 0*/) + const char * text, + int width/* = 0*/, + int height/* = 0*/, + TextAlign alignMask/* = kAlignCenter*/, + const char * fontName/* = nil*/, + int size/* = 0*/) { - bool bRet = false; + bool ret = false; do { - CC_BREAK_IF(! pText); + CC_BREAK_IF(!text || 0 == strlen(text)); BitmapDC &dc = sharedBitmapDC(); - //const char* pFullFontName = FileUtils::getInstance()->fullPathFromRelativePath(pFontName); - - CC_BREAK_IF(! dc.getBitmap(pText, nWidth, nHeight, eAlignMask, pFontName, nSize)); + CC_BREAK_IF(! dc.getBitmap(text, width, height, alignMask, fontName, size)); // assign the dc._data to _data in order to save time _data = dc._data; @@ -478,13 +476,13 @@ bool Image::initWithString( _preMulti = true; _dataLen = _width * _height * 4; - bRet = true; + ret = true; dc.reset(); }while (0); //do nothing - return bRet; + return ret; } NS_CC_END