diff --git a/yg/overlay.cpp b/yg/overlay.cpp index 6e5df8c411..854739ec74 100644 --- a/yg/overlay.cpp +++ b/yg/overlay.cpp @@ -259,10 +259,13 @@ namespace yg void Overlay::processOverlayElement(shared_ptr const & oe) { - if (m_couldOverlap) - addOverlayElement(oe); - else - replaceOverlayElement(oe); + if (oe->isValid()) + { + if (m_couldOverlap) + addOverlayElement(oe); + else + replaceOverlayElement(oe); + } } bool greater_priority(shared_ptr const & l, diff --git a/yg/overlay_element.cpp b/yg/overlay_element.cpp index 1df59188fc..2d53008b75 100644 --- a/yg/overlay_element.cpp +++ b/yg/overlay_element.cpp @@ -17,6 +17,7 @@ namespace yg m_isNeedRedraw(true), m_isFrozen(false), m_isVisible(true), + m_isValid(true), m_isDirtyRect(true), m_isDirtyRoughRect(true) {} @@ -151,6 +152,16 @@ namespace yg return false; } + bool OverlayElement::isValid() const + { + return m_isValid; + } + + void OverlayElement::setIsValid(bool flag) + { + m_isValid = flag; + } + bool OverlayElement::roughHitTest(m2::PointD const & pt) const { return roughBoundRect().IsPointInside(pt); diff --git a/yg/overlay_element.hpp b/yg/overlay_element.hpp index 4bf1d606d1..1beb7d9e71 100644 --- a/yg/overlay_element.hpp +++ b/yg/overlay_element.hpp @@ -24,6 +24,7 @@ namespace yg bool m_isNeedRedraw; bool m_isFrozen; bool m_isVisible; + bool m_isValid; mutable bool m_isDirtyRect; mutable bool m_isDirtyRoughRect; @@ -74,6 +75,9 @@ namespace yg bool isVisible() const; void setIsVisible(bool flag); + bool isValid() const; + void setIsValid(bool flag); + bool hitTest(m2::PointD const & pt) const; bool roughHitTest(m2::PointD const & pt) const; diff --git a/yg/path_text_element.cpp b/yg/path_text_element.cpp index cd36f61a25..28ffb7441e 100644 --- a/yg/path_text_element.cpp +++ b/yg/path_text_element.cpp @@ -16,7 +16,7 @@ namespace yg p.m_position) { setPivot(m_glyphLayout.pivot()); - setIsVisible((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size())); + setIsValid((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size())); } PathTextElement::PathTextElement(PathTextElement const & src, math::Matrix const & m) @@ -24,7 +24,7 @@ namespace yg m_glyphLayout(src.m_glyphLayout, m) { setPivot(m_glyphLayout.pivot()); - setIsVisible((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size())); + setIsValid((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size())); } vector const & PathTextElement::boundRects() const @@ -63,16 +63,13 @@ namespace yg screen->drawRectangle(boundRects()[i], c, yg::maxDepth - 3); } - if (!isNeedRedraw()) + if (!isNeedRedraw() || !isVisible() || !isValid()) return; yg::FontDesc desc = m_fontDesc; if (desc.m_isMasked) { - if (!isVisible()) - return; - drawTextImpl(m_glyphLayout, screen, m, false, desc, yg::maxDepth - 1); desc.m_isMasked = false; }