From 7c895ddf388a7efc59b22e60687b6e800d21c49f Mon Sep 17 00:00:00 2001 From: vng Date: Mon, 2 May 2011 22:20:12 +0300 Subject: [PATCH] Revert "DrawRule order optimization. " This reverts commit 888b8d01792f1c4028f4ea24a99c0477900a24b9. --- base/buffer_vector.hpp | 8 -------- map/drawer_yg.cpp | 20 +++++--------------- map/drawer_yg.hpp | 2 +- map/framework.cpp | 10 ---------- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/base/buffer_vector.hpp b/base/buffer_vector.hpp index 6c5b884d2b..f29f89ad1b 100644 --- a/base/buffer_vector.hpp +++ b/base/buffer_vector.hpp @@ -92,19 +92,11 @@ public: T const * begin() const { return data(); } T const * end() const { return (data() + m_size); } - T * begin () {return data();} - T * end() {return (data() + m_size); } - T const * data() const { return (m_size > N ? &m_dynamic[0] : m_static.data()); } - T * data() - { - return (m_size > N ? &m_dynamic[0] : m_static.data()); - } - bool empty() const { return m_size == 0; } size_t size() const { return m_size; } diff --git a/map/drawer_yg.cpp b/map/drawer_yg.cpp index dae7afe15b..66a82bb049 100644 --- a/map/drawer_yg.cpp +++ b/map/drawer_yg.cpp @@ -137,7 +137,7 @@ void DrawerYG::drawSymbol(m2::PointD const & pt, rule_ptr_t pRule, yg::EPosition m_pScreen->drawSymbol(pt, id, pos, depth); } -void DrawerYG::drawPath(vector const *> const & pathes, di::DrawRule const * rules, size_t count) +void DrawerYG::drawPath(vector const & pts, di::DrawRule const * rules, size_t count) { // if any rule needs caching - cache as a whole vector bool flag = false; @@ -185,16 +185,9 @@ void DrawerYG::drawPath(vector const *> const & pathes, di::D } } - // draw every path in order with array of rules. - for (size_t i = 0; i < pathes.size(); ++i) - { - for (size_t j = 0; j < count; ++j) - m_pScreen->drawPath(&pathes[i]->at(0), pathes[i]->size(), 0, rules[j].m_rule->GetID(), rules[j].m_depth); - } - -/* for (size_t j = 0; j < count; ++j) - for (size_t i = 0; i < pathes.size(); ++i) - m_pScreen->drawPath(&pathes[i]->at(0), pathes[i]->size(), 0, rules[j].m_rule->GetID(), rules[j].m_depth);*/ + // draw path with array of rules + for (size_t i = 0; i < count; ++i) + m_pScreen->drawPath(&pts[0], pts.size(), 0, rules[i].m_rule->GetID(), rules[i].m_depth); } void DrawerYG::drawArea(vector const & pts, rule_ptr_t pRule, int depth) @@ -309,11 +302,8 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size if (!pathRules.empty()) { - vector const *> pathes; for (list::const_iterator i = pInfo->m_pathes.begin(); i != pInfo->m_pathes.end(); ++i) - pathes.push_back(&i->m_path); - - drawPath(pathes, pathRules.data(), pathRules.size()); + drawPath(i->m_path, pathRules.data(), pathRules.size()); } for (unsigned i = 0; i < count; ++i) diff --git a/map/drawer_yg.hpp b/map/drawer_yg.hpp index e2b8835781..ad65b789db 100644 --- a/map/drawer_yg.hpp +++ b/map/drawer_yg.hpp @@ -75,7 +75,7 @@ class DrawerYG protected: void drawSymbol(m2::PointD const & pt, rule_ptr_t pRule, yg::EPosition pos, int depth); void drawCircle(m2::PointD const & pt, rule_ptr_t pRule, yg::EPosition pos, int depth); - void drawPath(vector const * > const & pathes, di::DrawRule const * rules, size_t count); + void drawPath(vector const & pts, di::DrawRule const * rules, size_t count); void drawArea(vector const & pts, rule_ptr_t pRule, int depth); void drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, yg::EPosition pos, int depth); diff --git a/map/framework.cpp b/map/framework.cpp index 57969affd5..94aa261281 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -63,14 +63,6 @@ namespace fwork namespace { - struct less_depth - { - bool operator() (di::DrawRule const & r1, di::DrawRule const & r2) - { - return r1.m_depth < r2.m_depth; - } - }; - struct less_key { bool operator() (drule::Key const & r1, drule::Key const & r2) const @@ -186,8 +178,6 @@ namespace fwork rules[i] = di::DrawRule(drule::rules().Find(m_keys[i]), depth); } - sort(rules.begin(), rules.end(), less_depth()); - #ifdef PROFILER_DRAWING m_drawCount += m_keys.size(); #endif