Merge pull request #14055 from Dimon4eg/fix-crash-in-LoadingBar

fix crash in LoadingBar
This commit is contained in:
pandamicro 2015-10-08 11:22:43 +08:00
commit e32e8b95a4
1 changed files with 8 additions and 5 deletions

View File

@ -281,12 +281,15 @@ void LoadingBar::updateProgressBar()
setScale9Scale();
}
else
{
Sprite* innerSprite = _barRenderer->getSprite();
if (nullptr != innerSprite)
{
float res = _percent / 100.0f;
Sprite* spriteRenderer = _barRenderer->getSprite();
Rect rect = spriteRenderer->getTextureRect();
Rect rect = innerSprite->getTextureRect();
rect.size.width = _barRendererTextureSize.width * res;
spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);
innerSprite->setTextureRect(rect, innerSprite->isTextureRectRotated(), rect.size);
}
}
}