From d5f9daeec0e1044df0feba2d3e84809d4165fcab Mon Sep 17 00:00:00 2001 From: ExMix Date: Wed, 19 Nov 2014 09:33:16 +0300 Subject: review fix --- drape/color.hpp | 4 ++++ drape/glfunctions.cpp | 7 +------ drape_frontend/engine_context.cpp | 6 ++---- drape_frontend/shape_view_params.hpp | 10 ++++++++++ drape_frontend/tile_info.cpp | 6 +++--- drape_frontend/tile_info.hpp | 2 +- qt/qt.pro | 4 ++-- 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drape/color.hpp b/drape/color.hpp index d5f88fc686..20c575bbd6 100644 --- a/drape/color.hpp +++ b/drape/color.hpp @@ -19,6 +19,10 @@ struct Color uint8_t m_alfa; int GetColorInInt() const { return (m_alfa << 24) | (m_blue << 16) | (m_green << 8) | m_red; } + + static Color Black() { return Color(0, 0, 0, 255); } + static Color White() { return Color(255, 255, 255, 255); } + static Color Red() { return Color(255, 0, 0, 255); } }; struct ColorF diff --git a/drape/glfunctions.cpp b/drape/glfunctions.cpp index d412c3db41..01d01a8daa 100644 --- a/drape/glfunctions.cpp +++ b/drape/glfunctions.cpp @@ -321,11 +321,7 @@ void GLFunctions::glBindBuffer(uint32_t vbo, uint32_t target) ASSERT(glBindBufferFn != NULL, ()); #ifdef DEBUG threads::MutexGuard guard(g_mutex); - TKey key = make_pair(threads::GetCurrentThreadID(), target); - auto iter = g_boundBuffers.find(key); - if (iter != g_boundBuffers.end()) - g_boundBuffers.erase(iter); - g_boundBuffers.emplace(key, vbo); + g_boundBuffers[make_pair(threads::GetCurrentThreadID(), target)] = vbo; #endif GLCHECK(glBindBufferFn(target, vbo)); } @@ -335,7 +331,6 @@ void GLFunctions::glDeleteBuffer(uint32_t vbo) ASSERT(glDeleteBuffersFn != NULL, ()); #ifdef DEBUG threads::MutexGuard guard(g_mutex); - threads::ThreadID id = threads::GetCurrentThreadID(); for (TNode const & n : g_boundBuffers) ASSERT(n.second != vbo, ()); #endif diff --git a/drape_frontend/engine_context.cpp b/drape_frontend/engine_context.cpp index 35d0c76bd7..39c41c8ef8 100644 --- a/drape_frontend/engine_context.cpp +++ b/drape_frontend/engine_context.cpp @@ -44,7 +44,7 @@ void EngineContext::EndReadTile(TileKey const & key) df::LineViewParams p; p.m_baseGtoPScale = 1.0; p.m_cap = dp::ButtCap; - p.m_color = dp::Color(255, 0, 0, 255); + p.m_color = dp::Color::Red(); p.m_depth = 20000; p.m_width = 5; p.m_join = dp::RoundJoin; @@ -58,9 +58,7 @@ void EngineContext::EndReadTile(TileKey const & key) strings::to_string(key.m_y) + " " + strings::to_string(key.m_zoomLevel); - tp.m_primaryTextFont = df::FontDecl{ dp::Color(255, 0, 0, 255), - dp::Color(0, 0, 0, 0), - 30, true}; + tp.m_primaryTextFont = df::FontDecl(dp::Color::Red(), 30); InsertShape(key, dp::MovePointer(new TextShape(r.Center(), tp))); #endif diff --git a/drape_frontend/shape_view_params.hpp b/drape_frontend/shape_view_params.hpp index 04d8ce2091..e1ae4d3c9c 100644 --- a/drape_frontend/shape_view_params.hpp +++ b/drape_frontend/shape_view_params.hpp @@ -51,6 +51,16 @@ struct LineViewParams : CommonViewParams struct FontDecl { + FontDecl() = default; + FontDecl(dp::Color const & color, float size, + bool needOutline = false, dp::Color const & outlineColor = dp::Color::White()) + : m_color(color) + , m_outlineColor(outlineColor) + , m_size(size) + , m_needOutline(needOutline) + { + } + dp::Color m_color; dp::Color m_outlineColor; float m_size; diff --git a/drape_frontend/tile_info.cpp b/drape_frontend/tile_info.cpp index e7f8813e3f..b9bb044a37 100644 --- a/drape_frontend/tile_info.cpp +++ b/drape_frontend/tile_info.cpp @@ -55,7 +55,7 @@ void TileInfo::ReadFeatureIndex(MapDataProvider const & model) if (DoNeedReadIndex()) { CheckCanceled(); - model.ReadFeaturesID(bind(&TileInfo::operator(), this, _1), GetGlobalRect(), GetZoomLevel()); + model.ReadFeaturesID(bind(&TileInfo::ProcessID, this, _1), GetGlobalRect(), GetZoomLevel()); sort(m_featureInfo.begin(), m_featureInfo.end()); } } @@ -79,7 +79,7 @@ void TileInfo::ReadFeatures(MapDataProvider const & model, for_each(indexes.begin(), indexes.end(), IDsAccumulator(featuresToRead, m_featureInfo)); RuleDrawer drawer(bind(&TileInfo::InitStylist, this, _1 ,_2), m_key, context); - model.ReadFeatures(bind(&RuleDrawer::operator(), &drawer, _1), featuresToRead); + model.ReadFeatures(bind(ref(drawer), _1), featuresToRead); } } @@ -91,7 +91,7 @@ void TileInfo::Cancel(MemoryFeatureIndex & memIndex) memIndex.RemoveFeatures(m_featureInfo); } -void TileInfo::operator ()(FeatureID const & id) +void TileInfo::ProcessID(FeatureID const & id) { m_featureInfo.push_back(id); CheckCanceled(); diff --git a/drape_frontend/tile_info.hpp b/drape_frontend/tile_info.hpp index 988995aaff..b836fc293d 100644 --- a/drape_frontend/tile_info.hpp +++ b/drape_frontend/tile_info.hpp @@ -36,10 +36,10 @@ public: m2::RectD GetGlobalRect() const; TileKey const & GetTileKey() const { return m_key; } - void operator ()(FeatureID const & id); bool operator <(TileInfo const & other) const { return m_key < other.m_key; } private: + void ProcessID(FeatureID const & id); void InitStylist(FeatureType const & f, Stylist & s); void RequestFeatures(MemoryFeatureIndex & memIndex, vector & featureIndexes); void CheckCanceled() const; diff --git a/qt/qt.pro b/qt/qt.pro index 390c188bac..7e28ffb74e 100644 --- a/qt/qt.pro +++ b/qt/qt.pro @@ -127,7 +127,7 @@ CONFIG(drape){ SOURCES += \ drape_surface.cpp \ qtoglcontext.cpp \ - qtoglcontextfactory.cpp + qtoglcontextfactory.cpp \ } HEADERS += \ @@ -146,7 +146,7 @@ CONFIG(drape){ HEADERS += \ drape_surface.hpp \ qtoglcontext.hpp \ - qtoglcontextfactory.hpp + qtoglcontextfactory.hpp \ } RESOURCES += res/resources.qrc -- cgit v1.2.3