From 5a438ed9a16057845e81bbf31718ede29b92a136 Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Fri, 17 Apr 2015 15:26:43 +0800 Subject: [PATCH] Label:Fixed the shadow effect of system font might not be shown. --- cocos/2d/CCLabel.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 2c039da0c5..659407c250 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -788,17 +788,24 @@ void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,const //TODO: support blur for shadow _shadowBlurRadius = 0; - if (_textSprite && _shadowNode) + if (!_systemFontDirty && !_contentDirty && _textSprite) { - if (shadowColor != _shadowColor4F) + if (_shadowNode) { - Node::removeChild(_shadowNode, true); - _shadowNode = nullptr; - createShadowSpriteForSystemFont(); + if (shadowColor != _shadowColor4F) + { + Node::removeChild(_shadowNode, true); + _shadowNode = nullptr; + createShadowSpriteForSystemFont(); + } + else + { + _shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height); + } } else { - _shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height); + createShadowSpriteForSystemFont(); } }