mirror of https://github.com/axmolengine/axmol.git
closed #3867: "Testing empty labels" in LabelTest crashes on Linux platform.
This commit is contained in:
parent
208939ab2a
commit
6c69626a4f
|
@ -450,23 +450,21 @@ static BitmapDC& sharedBitmapDC()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Image::initWithString(
|
bool Image::initWithString(
|
||||||
const char * pText,
|
const char * text,
|
||||||
int nWidth/* = 0*/,
|
int width/* = 0*/,
|
||||||
int nHeight/* = 0*/,
|
int height/* = 0*/,
|
||||||
TextAlign eAlignMask/* = kAlignCenter*/,
|
TextAlign alignMask/* = kAlignCenter*/,
|
||||||
const char * pFontName/* = nil*/,
|
const char * fontName/* = nil*/,
|
||||||
int nSize/* = 0*/)
|
int size/* = 0*/)
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool ret = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
CC_BREAK_IF(! pText);
|
CC_BREAK_IF(!text || 0 == strlen(text));
|
||||||
|
|
||||||
BitmapDC &dc = sharedBitmapDC();
|
BitmapDC &dc = sharedBitmapDC();
|
||||||
|
|
||||||
//const char* pFullFontName = FileUtils::getInstance()->fullPathFromRelativePath(pFontName);
|
CC_BREAK_IF(! dc.getBitmap(text, width, height, alignMask, fontName, size));
|
||||||
|
|
||||||
CC_BREAK_IF(! dc.getBitmap(pText, nWidth, nHeight, eAlignMask, pFontName, nSize));
|
|
||||||
|
|
||||||
// assign the dc._data to _data in order to save time
|
// assign the dc._data to _data in order to save time
|
||||||
_data = dc._data;
|
_data = dc._data;
|
||||||
|
@ -478,13 +476,13 @@ bool Image::initWithString(
|
||||||
_preMulti = true;
|
_preMulti = true;
|
||||||
_dataLen = _width * _height * 4;
|
_dataLen = _width * _height * 4;
|
||||||
|
|
||||||
bRet = true;
|
ret = true;
|
||||||
|
|
||||||
dc.reset();
|
dc.reset();
|
||||||
}while (0);
|
}while (0);
|
||||||
|
|
||||||
//do nothing
|
//do nothing
|
||||||
return bRet;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
Loading…
Reference in New Issue