forked from organicmaps/organicmaps
[core] reduce location state recache operations count
This commit is contained in:
parent
0adf799b3e
commit
359071ac92
11 changed files with 22 additions and 17 deletions
|
@ -58,10 +58,11 @@ namespace graphics
|
|||
return m_pivot;
|
||||
}
|
||||
|
||||
void OverlayElement::setPivot(m2::PointD const & pivot)
|
||||
void OverlayElement::setPivot(m2::PointD const & pivot, bool dirtyFlag)
|
||||
{
|
||||
m_pivot = pivot;
|
||||
setIsDirtyLayout(true);
|
||||
if (dirtyFlag)
|
||||
setIsDirtyLayout(true);
|
||||
}
|
||||
|
||||
graphics::EPosition OverlayElement::position() const
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace graphics
|
|||
virtual double priority() const;
|
||||
|
||||
m2::PointD const & pivot() const;
|
||||
virtual void setPivot(m2::PointD const & pv);
|
||||
virtual void setPivot(m2::PointD const & pv, bool dirtyFlag = true);
|
||||
|
||||
m2::PointD const point(EPosition pos) const;
|
||||
|
||||
|
|
|
@ -77,9 +77,9 @@ namespace graphics
|
|||
drawTextImpl(m_glyphLayout, screen, m, false, false, desc, depth() + doffs++);
|
||||
}
|
||||
|
||||
void PathTextElement::setPivot(m2::PointD const & pivot)
|
||||
void PathTextElement::setPivot(m2::PointD const & pivot, bool dirtyFlag)
|
||||
{
|
||||
TextElement::setPivot(pivot);
|
||||
TextElement::setPivot(pivot, dirtyFlag);
|
||||
|
||||
m_glyphLayout.setPivot(pivot);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace graphics
|
|||
|
||||
void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
void setPivot(m2::PointD const & pivot);
|
||||
void setPivot(m2::PointD const & pivot, bool dirtyFlag = true);
|
||||
void setTransformation(const math::Matrix<double, 3, 3> & m);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -225,12 +225,12 @@ namespace graphics
|
|||
}
|
||||
}
|
||||
|
||||
void StraightTextElement::setPivot(m2::PointD const & pv)
|
||||
void StraightTextElement::setPivot(m2::PointD const & pv, bool dirtyFlag)
|
||||
{
|
||||
m2::PointD oldPv = pivot();
|
||||
m2::PointD offs = pv - oldPv;
|
||||
|
||||
TextElement::setPivot(pv);
|
||||
TextElement::setPivot(pv, dirtyFlag);
|
||||
|
||||
for (size_t i = 0; i < m_glyphLayouts.size(); ++i)
|
||||
m_glyphLayouts[i].setPivot(m_glyphLayouts[i].pivot() + offs);
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace graphics
|
|||
|
||||
void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
void setPivot(m2::PointD const & pv);
|
||||
void setPivot(m2::PointD const & pv, bool dirtyFlag = true);
|
||||
|
||||
void setTransformation(const math::Matrix<double, 3, 3> & m);
|
||||
|
||||
|
|
|
@ -195,10 +195,10 @@ namespace gui
|
|||
}
|
||||
}
|
||||
|
||||
void Button::setPivot(m2::PointD const & pv)
|
||||
void Button::setPivot(m2::PointD const & pv, bool dirtyFlag)
|
||||
{
|
||||
m_textView->setPivot(pv);
|
||||
Element::setPivot(pv);
|
||||
m_textView->setPivot(pv, dirtyFlag);
|
||||
Element::setPivot(pv, dirtyFlag);
|
||||
}
|
||||
|
||||
void Button::setFont(EState state, graphics::FontDesc const & font)
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace gui
|
|||
virtual m2::RectD GetBoundRect() const;
|
||||
|
||||
void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
void setPivot(m2::PointD const & pv);
|
||||
void setPivot(m2::PointD const & pv, bool dirtyFlag = true);
|
||||
|
||||
void purge();
|
||||
void layout();
|
||||
|
|
|
@ -143,9 +143,9 @@ namespace gui
|
|||
position()));
|
||||
}
|
||||
|
||||
void CachedTextView::setPivot(m2::PointD const & pv)
|
||||
void CachedTextView::setPivot(m2::PointD const & pv, bool dirtyFlag)
|
||||
{
|
||||
Element::setPivot(pv);
|
||||
Element::setPivot(pv, dirtyFlag);
|
||||
|
||||
if (m_maskedLayout)
|
||||
m_maskedLayout->setPivot(pivot());
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace gui
|
|||
|
||||
void setFont(EState state, graphics::FontDesc const & desc);
|
||||
|
||||
void setPivot(m2::PointD const & pv);
|
||||
void setPivot(m2::PointD const & pv, bool dirtyFlag = true);
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../indexer/mercator.hpp"
|
||||
|
||||
#include "../platform/location.hpp"
|
||||
#include "../platform/settings.hpp"
|
||||
|
||||
#include "../geometry/rect2d.hpp"
|
||||
#include "../geometry/transformations.hpp"
|
||||
|
@ -241,6 +242,9 @@ State::State(Params const & p)
|
|||
{
|
||||
m_locationAreaColor = p.m_locationAreaColor;
|
||||
m_framework = p.m_framework;
|
||||
bool isBench = false;
|
||||
if (Settings::Get("IsBenchmarking", isBench) && isBench)
|
||||
m_modeInfo = UnknownPosition;
|
||||
|
||||
setIsVisible(false);
|
||||
}
|
||||
|
@ -454,7 +458,7 @@ void State::update()
|
|||
if (isVisible() && IsModeHasPosition())
|
||||
{
|
||||
m2::PointD const pxPosition = m_framework->GetNavigator().GtoP(Position());
|
||||
setPivot(pxPosition);
|
||||
setPivot(pxPosition, false);
|
||||
|
||||
if (m_animTask)
|
||||
static_cast<RotateAndFollowAnim *>(m_animTask.get())->Update();
|
||||
|
|
Loading…
Add table
Reference in a new issue