Additional unnecessary set dirty of ui widgets

This commit is contained in:
Haneol Park 2014-11-25 20:42:03 +09:00
parent d25fdca4af
commit a6e4b31b0d
5 changed files with 29 additions and 9 deletions

View File

@ -216,7 +216,7 @@ void Button::loadTextures(const std::string& normal,
void Button::loadTextureNormal(const std::string& normal,TextureResType texType) void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
{ {
if (normal.empty()) if (normal.empty() || (_normalFileName == normal && _normalTexType == texType))
{ {
return; return;
} }
@ -256,7 +256,7 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
void Button::loadTexturePressed(const std::string& selected,TextureResType texType) void Button::loadTexturePressed(const std::string& selected,TextureResType texType)
{ {
if (selected.empty()) if (selected.empty() || (_clickedFileName == selected && _pressedTexType == texType))
{ {
return; return;
} }
@ -285,7 +285,7 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy
void Button::loadTextureDisabled(const std::string& disabled,TextureResType texType) void Button::loadTextureDisabled(const std::string& disabled,TextureResType texType)
{ {
if (disabled.empty()) if (disabled.empty() || (_disabledFileName == disabled && _disabledTexType == texType))
{ {
return; return;
} }
@ -741,6 +741,10 @@ void Button::setPressedActionEnabled(bool enabled)
void Button::setTitleText(const std::string& text) void Button::setTitleText(const std::string& text)
{ {
if (text == getTitleText())
{
return;
}
_titleRenderer->setString(text); _titleRenderer->setString(text);
updateContentSize(); updateContentSize();
} }

View File

@ -165,7 +165,7 @@ void CheckBox::loadTextures(const std::string& backGround,
void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResType texType) void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResType texType)
{ {
if (backGround.empty()) if (backGround.empty() || (_backGroundFileName == backGround && _backGroundTexType == texType))
{ {
return; return;
} }
@ -191,7 +191,7 @@ void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResTyp
void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType) void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType)
{ {
if (backGroundSelected.empty()) if (backGroundSelected.empty() || (_backGroundSelectedFileName == backGroundSelected && _backGroundSelectedTexType == texType))
{ {
return; return;
} }
@ -216,7 +216,7 @@ void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelect
void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType texType) void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType texType)
{ {
if (cross.empty()) if (cross.empty() || (_frontCrossFileName == cross && _frontCrossTexType == texType))
{ {
return; return;
} }
@ -241,7 +241,7 @@ void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType tex
void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType) void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType)
{ {
if (backGroundDisabled.empty()) if (backGroundDisabled.empty() || (_backGroundDisabledFileName == backGroundDisabled && _backGroundDisabledTexType == texType))
{ {
return; return;
} }
@ -266,7 +266,7 @@ void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabl
void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType) void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType)
{ {
if (frontCrossDisabled.empty()) if (frontCrossDisabled.empty() || (_frontCrossDisabledFileName == frontCrossDisabled && _frontCrossDisabledTexType == texType))
{ {
return; return;
} }

View File

@ -212,7 +212,15 @@ const Rect& LoadingBar::getCapInsets()const
void LoadingBar::setPercent(float percent) void LoadingBar::setPercent(float percent)
{ {
if ( percent < 0 || percent > 100 || _percent == percent) if (percent > 100)
{
percent = 100;
}
if (percent < 0)
{
percent = 0;
}
if (_percent == percent)
{ {
return; return;
} }

View File

@ -103,6 +103,10 @@ void TextAtlas::setProperty(const std::string& stringValue, const std::string& c
void TextAtlas::setString(const std::string& value) void TextAtlas::setString(const std::string& value)
{ {
if (value == _labelAtlasRenderer->getString())
{
return;
}
_stringValue = value; _stringValue = value;
_labelAtlasRenderer->setString(value); _labelAtlasRenderer->setString(value);
updateContentSizeWithTextureSize(_labelAtlasRenderer->getContentSize()); updateContentSizeWithTextureSize(_labelAtlasRenderer->getContentSize());

View File

@ -94,6 +94,10 @@ void TextBMFont::setFntFile(const std::string& fileName)
void TextBMFont::setString(const std::string& value) void TextBMFont::setString(const std::string& value)
{ {
if (value == _labelBMFontRenderer->getString())
{
return;
}
_stringValue = value; _stringValue = value;
if (!_fntFileHasInit) if (!_fntFileHasInit)
{ {