diff --git a/map/render_queue_routine.cpp b/map/render_queue_routine.cpp index caebb4e29d..36ddff891d 100644 --- a/map/render_queue_routine.cpp +++ b/map/render_queue_routine.cpp @@ -332,18 +332,24 @@ void RenderQueueRoutine::Do() if (isPanning) { - m2::RectD oldRect = m2::RectD(m_renderState->m_currentScreen.GtoP(prevScreen.PtoG(m2::PointD(prevRect.minX(), prevRect.minY()))), - m_renderState->m_currentScreen.GtoP(prevScreen.PtoG(m2::PointD(prevRect.maxX(), prevRect.maxY())))); + math::Matrix offsetM = prevScreen.PtoGMatrix() * m_renderState->m_currentScreen.GtoPMatrix(); + m2::RectD oldRect = m2::RectD(m2::PointD(prevRect.minX(), prevRect.minY()) * offsetM, + m2::PointD(prevRect.maxX(), prevRect.maxY()) * offsetM); m2::RectD redrawTextRect(curRect); if (!redrawTextRect.Intersect(oldRect)) redrawTextRect = m2::RectD(0, 0, 0, 0); - shared_ptr infoLayer(new yg::InfoLayer()); + m_threadDrawer->screen()->infoLayer()->offset( + m2::PointD(0, 0) * offsetM, + redrawTextRect + ); + +/* shared_ptr infoLayer(new yg::InfoLayer()); infoLayer->merge(*m_threadDrawer->screen()->infoLayer().get(), prevScreen.PtoGMatrix() * m_renderState->m_currentScreen.GtoPMatrix()); - m_threadDrawer->screen()->setInfoLayer(infoLayer); + m_threadDrawer->screen()->setInfoLayer(infoLayer);*/ } else m_threadDrawer->screen()->infoLayer()->clear(); diff --git a/yg/info_layer.cpp b/yg/info_layer.cpp index 827bf91ed8..a05611b82d 100644 --- a/yg/info_layer.cpp +++ b/yg/info_layer.cpp @@ -6,6 +6,8 @@ #include "../std/bind.hpp" #include "../std/vector.hpp" +#include "../base/logging.hpp" + namespace yg { m2::RectD const StraightTextElementTraits::LimitRect(StraightTextElement const & elem) @@ -49,7 +51,7 @@ namespace yg m_tree.ForEach(bind(&StraightTextElement::draw, _1, r, m)); } -/* template + template void offsetTree(Tree & tree, m2::PointD const & offs, m2::RectD const & rect) { typedef typename Tree::elem_t elem_t; @@ -63,11 +65,12 @@ namespace yg m2::RectD limitRect = it->boundRect().GetGlobalRect(); bool doAppend = false; - it->setIsNeedRedraw(true); + it->setIsNeedRedraw(false); it->setIsFrozen(false); if (rect.IsRectInside(limitRect)) { + it->setIsNeedRedraw(false); it->setIsFrozen(true); doAppend = true; } @@ -75,6 +78,7 @@ namespace yg if (rect.IsIntersect(limitRect)) { it->setIsFrozen(true); + it->setIsNeedRedraw(true); doAppend = true; } @@ -136,7 +140,7 @@ namespace yg offsetTextTree(offs, rect); offsetPathTexts(offs, rect); offsetSymbols(offs, rect); - }*/ + } void InfoLayer::clear() { diff --git a/yg/info_layer.hpp b/yg/info_layer.hpp index a67fd123ef..df472332ed 100644 --- a/yg/info_layer.hpp +++ b/yg/info_layer.hpp @@ -37,9 +37,9 @@ namespace yg typedef map > symbols_map_t; symbols_map_t m_symbolsMap; -/* void offsetPathTexts(m2::PointD const & offs, m2::RectD const & rect); + void offsetPathTexts(m2::PointD const & offs, m2::RectD const & rect); void offsetTextTree(m2::PointD const & offs, m2::RectD const & rect); - void offsetSymbols(m2::PointD const & offs, m2::RectD const & rect);*/ + void offsetSymbols(m2::PointD const & offs, m2::RectD const & rect); void addPathTextImpl(PathTextElement const & pte); void addStraightTextImpl(StraightTextElement const & ste); @@ -55,7 +55,7 @@ namespace yg void addSymbol(SymbolElement const & se, math::Matrix const & m); -// void offset(m2::PointD const & offs, m2::RectD const & rect); + void offset(m2::PointD const & offs, m2::RectD const & rect); void clear(); diff --git a/yg/overlay_element.cpp b/yg/overlay_element.cpp index cdea08ead5..bd1a5cc746 100644 --- a/yg/overlay_element.cpp +++ b/yg/overlay_element.cpp @@ -35,10 +35,10 @@ namespace yg return res; } -/* void OverlayElement::offset(m2::PointD const & offs) + void OverlayElement::offset(m2::PointD const & offs) { m_pivot += offs; - }*/ + } m2::PointD const & OverlayElement::pivot() const { diff --git a/yg/overlay_element.hpp b/yg/overlay_element.hpp index 521ae58353..3fe7b2fd60 100644 --- a/yg/overlay_element.hpp +++ b/yg/overlay_element.hpp @@ -55,6 +55,8 @@ namespace yg bool isNeedRedraw() const; void setIsNeedRedraw(bool flag); + + void offset(m2::PointD const & offs); }; } diff --git a/yg/text_element.cpp b/yg/text_element.cpp index 359757c0b7..25d76fbc16 100644 --- a/yg/text_element.cpp +++ b/yg/text_element.cpp @@ -81,8 +81,20 @@ namespace yg void StraightTextElement::draw(gl::OverlayRenderer * screen, math::Matrix const & m) const { - if (!isNeedRedraw()) - return; + if (screen->isDebugging()) + { + yg::Color c(255, 255, 255, 32); + + if (isFrozen()) + c = yg::Color(0, 0, 255, 64); + if (isNeedRedraw()) + c = yg::Color(255, 0, 0, 64); + + screen->drawRectangle(boundRect(), c, yg::maxDepth - 3); + } + else + if (!isNeedRedraw()) + return; yg::FontDesc desc = m_fontDesc; if (m_fontDesc.m_isMasked) @@ -94,6 +106,12 @@ namespace yg drawTextImpl(m_glyphLayout, screen, m, desc, yg::maxDepth); } + void StraightTextElement::offset(m2::PointD const & offs) + { + TextElement::offset(offs); + m_glyphLayout.setPivot(pivot()); + } + PathTextElement::PathTextElement(Params const & p) : TextElement(p), m_glyphLayout(p.m_glyphCache, @@ -122,6 +140,18 @@ namespace yg void PathTextElement::draw(gl::OverlayRenderer * screen, math::Matrix const & m) const { + if (screen->isDebugging()) + { + yg::Color c(255, 255, 255, 32); + + if (isFrozen()) + c = yg::Color(0, 0, 255, 64); + if (isNeedRedraw()) + c = yg::Color(255, 0, 0, 64); + + screen->drawRectangle(boundRect(), c, yg::maxDepth - 3); + } + yg::FontDesc desc = m_fontDesc; if (m_fontDesc.m_isMasked) { @@ -131,4 +161,10 @@ namespace yg drawTextImpl(m_glyphLayout, screen, m, desc, yg::maxDepth); } + + void PathTextElement::offset(m2::PointD const & offs) + { + TextElement::offset(offs); + m_glyphLayout.setPivot(pivot()); + } } diff --git a/yg/text_element.hpp b/yg/text_element.hpp index d8001dbe51..6969bbbe24 100644 --- a/yg/text_element.hpp +++ b/yg/text_element.hpp @@ -72,6 +72,7 @@ namespace yg m2::AARectD const boundRect() const; void draw(gl::OverlayRenderer * r, math::Matrix const & m) const; + void offset(m2::PointD const & offs); }; class PathTextElement : public TextElement @@ -95,5 +96,6 @@ namespace yg m2::AARectD const boundRect() const; void draw(gl::OverlayRenderer * r, math::Matrix const & m) const; + void offset(m2::PointD const & offs); }; }