Merge pull request #12898 from WenhaiLin/v3.8-systemfont-invisible-fix

Label:Fixed system font may be invisible when there are multiple cameras.
This commit is contained in:
子龙山人 2015-07-20 10:24:21 +08:00
commit 87fd0d55ad
2 changed files with 8 additions and 9 deletions

View File

@ -1273,7 +1273,7 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare
{
updateContent();
}
uint32_t flags = processParentFlags(parentTransform, parentFlags);
if (!_originalUTF8String.empty() && _shadowEnabled && (_shadowDirty || (flags & FLAGS_DIRTY_MASK)))
@ -1318,9 +1318,8 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare
else
break;
}
// self draw
if (visibleByCamera)
this->drawSelf(renderer, flags);
this->drawSelf(visibleByCamera, renderer, flags);
for (auto it = _children.cbegin() + i; it != _children.cend(); ++it)
{
@ -1328,15 +1327,15 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare
}
}
else if (visibleByCamera)
else
{
this->drawSelf(renderer, flags);
this->drawSelf(visibleByCamera, renderer, flags);
}
_director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}
void Label::drawSelf(Renderer* renderer, uint32_t flags)
void Label::drawSelf(bool visibleByCamera, Renderer* renderer, uint32_t flags)
{
if (_textSprite)
{
@ -1346,7 +1345,7 @@ void Label::drawSelf(Renderer* renderer, uint32_t flags)
}
_textSprite->visit(renderer, _modelViewTransform, flags);
}
else
else if (visibleByCamera)
{
draw(renderer, _modelViewTransform, flags);
}

View File

@ -512,7 +512,7 @@ protected:
void onDraw(const Mat4& transform, bool transformUpdated);
void onDrawShadow(GLProgram* glProgram);
void drawSelf(Renderer* renderer, uint32_t flags);
void drawSelf(bool visibleByCamera, Renderer* renderer, uint32_t flags);
virtual void alignText();
bool computeHorizontalKernings(const std::u16string& stringToRender);