diff --git a/cocos2dx/base_nodes/CCAtlasNode.cpp b/cocos2dx/base_nodes/CCAtlasNode.cpp index 84308d0852..7a7bbffb99 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.cpp +++ b/cocos2dx/base_nodes/CCAtlasNode.cpp @@ -121,15 +121,12 @@ bool CCAtlasNode::initWithTexture(CCTexture2D* texture, unsigned int tileWidth, void CCAtlasNode::calculateMaxItems() { - CCSize s; + CCSize s = m_pTextureAtlas->getTexture()->getContentSize(); + if (m_bIgnoreContentScaleFactor) { s = m_pTextureAtlas->getTexture()->getContentSizeInPixels(); } - else - { - s = m_pTextureAtlas->getTexture()->getContentSize(); - } m_uItemsPerColumn = (int)(s.height / m_uItemHeight); m_uItemsPerRow = (int)(s.width / m_uItemWidth); diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index f499f5d9e4..c30901ae28 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -123,18 +123,14 @@ void CCLabelAtlas::updateAtlasValues() CCTexture2D *texture = m_pTextureAtlas->getTexture(); float textureWide = (float) texture->getPixelsWide(); float textureHigh = (float) texture->getPixelsHigh(); - float itemWidthInPixels; - float itemHeightInPixels; + float itemWidthInPixels = m_uItemWidth * CC_CONTENT_SCALE_FACTOR(); + float itemHeightInPixels = m_uItemHeight * CC_CONTENT_SCALE_FACTOR(); + if (m_bIgnoreContentScaleFactor) { itemWidthInPixels = m_uItemWidth; itemHeightInPixels = m_uItemHeight; } - else - { - itemWidthInPixels = m_uItemWidth * CC_CONTENT_SCALE_FACTOR(); - itemHeightInPixels = m_uItemHeight * CC_CONTENT_SCALE_FACTOR(); - } for(unsigned int i = 0; i < n; i++) { unsigned char a = s[i] - m_uMapStartChar;