diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/overlay_renderer.cpp | 59 | ||||
-rw-r--r-- | graphics/overlay_renderer.hpp | 12 |
2 files changed, 24 insertions, 47 deletions
diff --git a/graphics/overlay_renderer.cpp b/graphics/overlay_renderer.cpp index 09c9a6d0c4..6e1ab5cb38 100644 --- a/graphics/overlay_renderer.cpp +++ b/graphics/overlay_renderer.cpp @@ -12,7 +12,8 @@ namespace graphics { OverlayRenderer::Params::Params() : m_drawTexts(true), - m_drawSymbols(true) + m_drawSymbols(true), + m_overlay(NULL) { } @@ -29,14 +30,10 @@ namespace graphics if (!m_drawSymbols) return; - shared_ptr<OverlayElement> oe(new SymbolElement(params)); - - math::Matrix<double, 3, 3> id = math::Identity<double, 3>(); - - if (!m_overlay.get()) - oe->draw(this, id); + if (!m_overlay) + SymbolElement(params).draw(this, math::Identity<double, 3>()); else - m_overlay->processOverlayElement(oe); + m_overlay->processOverlayElement(new SymbolElement(params)); } void OverlayRenderer::drawSymbol(m2::PointD const & pt, string const & name, EPosition pos, int depth) @@ -64,14 +61,10 @@ namespace graphics params.m_pivot = pt; params.m_ci = ci; - shared_ptr<OverlayElement> oe(new CircleElement(params)); - - math::Matrix<double, 3, 3> id = math::Identity<double, 3>(); - - if (!m_overlay.get()) - oe->draw(this, id); + if (!m_overlay) + CircleElement(params).draw(this, math::Identity<double, 3>()); else - m_overlay->processOverlayElement(oe); + m_overlay->processOverlayElement(new CircleElement(params)); } void OverlayRenderer::drawText(FontDesc const & fontDesc, @@ -97,14 +90,10 @@ namespace graphics params.m_offset = m2::PointD(0,0); params.m_glyphCache = glyphCache(); - shared_ptr<OverlayElement> oe(new StraightTextElement(params)); - - math::Matrix<double, 3, 3> id = math::Identity<double, 3>(); - - if (!m_overlay.get()) - oe->draw(this, id); + if (!m_overlay) + StraightTextElement(params).draw(this, math::Identity<double, 3>()); else - m_overlay->processOverlayElement(oe); + m_overlay->processOverlayElement(new StraightTextElement(params)); } void OverlayRenderer::drawTextEx(StraightTextElement::Params & params) @@ -114,14 +103,10 @@ namespace graphics params.m_glyphCache = glyphCache(); - shared_ptr<OverlayElement> oe(new StraightTextElement(params)); - - math::Matrix<double, 3, 3> id = math::Identity<double, 3>(); - - if (!m_overlay.get()) - oe->draw(this, id); + if (!m_overlay) + StraightTextElement(params).draw(this, math::Identity<double, 3>()); else - m_overlay->processOverlayElement(oe); + m_overlay->processOverlayElement(new StraightTextElement(params)); } void OverlayRenderer::drawTextEx(FontDesc const & primaryFont, @@ -178,14 +163,10 @@ namespace graphics params.m_glyphCache = glyphCache(); params.m_pivot = path[0]; - shared_ptr<PathTextElement> pte(new PathTextElement(params)); - - math::Matrix<double, 3, 3> id = math::Identity<double, 3>(); - - if (!m_overlay.get()) - pte->draw(this, id); + if (!m_overlay) + PathTextElement(params).draw(this, math::Identity<double, 3>()); else - m_overlay->processOverlayElement(pte); + m_overlay->processOverlayElement(new PathTextElement(params)); } void OverlayRenderer::drawPathText(FontDesc const & fontDesc, @@ -212,18 +193,18 @@ namespace graphics depth); } - void OverlayRenderer::setOverlay(shared_ptr<Overlay> const & overlay) + void OverlayRenderer::setOverlay(Overlay *overlay) { m_overlay = overlay; } - shared_ptr<Overlay> const & OverlayRenderer::overlay() const + Overlay * OverlayRenderer::overlay() const { return m_overlay; } void OverlayRenderer::resetOverlay() { - m_overlay.reset(); + m_overlay = NULL; } } diff --git a/graphics/overlay_renderer.hpp b/graphics/overlay_renderer.hpp index 62f7493de5..7b4ae9ac2b 100644 --- a/graphics/overlay_renderer.hpp +++ b/graphics/overlay_renderer.hpp @@ -16,11 +16,7 @@ namespace graphics bool m_drawTexts; bool m_drawSymbols; - shared_ptr<graphics::Overlay> m_overlay; - - typedef map<m2::PointI, shared_ptr<OverlayElement> > TElements; - - TElements m_elements; + graphics::Overlay * m_overlay; public: @@ -28,7 +24,7 @@ namespace graphics { bool m_drawTexts; bool m_drawSymbols; - shared_ptr<graphics::Overlay> m_overlay; + graphics::Overlay * m_overlay; Params(); }; @@ -85,9 +81,9 @@ namespace graphics size_t offsSize, double depth); - void setOverlay(shared_ptr<Overlay> const & overlay); + void setOverlay(Overlay * overlay); - shared_ptr<Overlay> const & overlay() const; + Overlay * overlay() const; void resetOverlay(); }; |