fixed #2217: Updating logic when m_bIgnoreContentScaleFactor is enabled.

This commit is contained in:
James Chen 2013-05-23 16:12:04 +08:00
parent 42102bcf0a
commit d6a0af86eb
2 changed files with 5 additions and 12 deletions

View File

@ -121,15 +121,12 @@ bool CCAtlasNode::initWithTexture(CCTexture2D* texture, unsigned int tileWidth,
void CCAtlasNode::calculateMaxItems() void CCAtlasNode::calculateMaxItems()
{ {
CCSize s; CCSize s = m_pTextureAtlas->getTexture()->getContentSize();
if (m_bIgnoreContentScaleFactor) if (m_bIgnoreContentScaleFactor)
{ {
s = m_pTextureAtlas->getTexture()->getContentSizeInPixels(); s = m_pTextureAtlas->getTexture()->getContentSizeInPixels();
} }
else
{
s = m_pTextureAtlas->getTexture()->getContentSize();
}
m_uItemsPerColumn = (int)(s.height / m_uItemHeight); m_uItemsPerColumn = (int)(s.height / m_uItemHeight);
m_uItemsPerRow = (int)(s.width / m_uItemWidth); m_uItemsPerRow = (int)(s.width / m_uItemWidth);

View File

@ -123,18 +123,14 @@ void CCLabelAtlas::updateAtlasValues()
CCTexture2D *texture = m_pTextureAtlas->getTexture(); CCTexture2D *texture = m_pTextureAtlas->getTexture();
float textureWide = (float) texture->getPixelsWide(); float textureWide = (float) texture->getPixelsWide();
float textureHigh = (float) texture->getPixelsHigh(); float textureHigh = (float) texture->getPixelsHigh();
float itemWidthInPixels; float itemWidthInPixels = m_uItemWidth * CC_CONTENT_SCALE_FACTOR();
float itemHeightInPixels; float itemHeightInPixels = m_uItemHeight * CC_CONTENT_SCALE_FACTOR();
if (m_bIgnoreContentScaleFactor) if (m_bIgnoreContentScaleFactor)
{ {
itemWidthInPixels = m_uItemWidth; itemWidthInPixels = m_uItemWidth;
itemHeightInPixels = m_uItemHeight; 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++) { for(unsigned int i = 0; i < n; i++) {
unsigned char a = s[i] - m_uMapStartChar; unsigned char a = s[i] - m_uMapStartChar;