diff --git a/cocos/ui/UIImageView.cpp b/cocos/ui/UIImageView.cpp index 209878efe1..c9e0590182 100644 --- a/cocos/ui/UIImageView.cpp +++ b/cocos/ui/UIImageView.cpp @@ -112,7 +112,7 @@ void ImageView::initRenderer() void ImageView::loadTexture(const std::string& fileName, TextureResType texType) { - if (fileName.empty()) + if (fileName.empty() || (_textureFile == fileName && _imageTexType == texType)) { return; } diff --git a/cocos/ui/UILoadingBar.cpp b/cocos/ui/UILoadingBar.cpp index acca094563..972e5fd0ed 100644 --- a/cocos/ui/UILoadingBar.cpp +++ b/cocos/ui/UILoadingBar.cpp @@ -212,7 +212,7 @@ const Rect& LoadingBar::getCapInsets()const void LoadingBar::setPercent(float percent) { - if ( percent < 0 || percent > 100) + if ( percent < 0 || percent > 100 || _percent == percent) { return; } diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index 460863db39..2523ce1642 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -108,6 +108,10 @@ void Text::initRenderer() void Text::setString(const std::string &text) { + if (text == _labelRenderer->getString()) + { + return; + } _labelRenderer->setString(text); updateContentSizeWithTextureSize(_labelRenderer->getContentSize()); _labelRendererAdaptDirty = true;