From fedf07299ef4208236c15c3c3c836d2a4d36f3dc Mon Sep 17 00:00:00 2001 From: Dmitry Kunin Date: Mon, 13 Jan 2014 16:38:56 +0300 Subject: [PATCH] [codereview] Moved depth to constructor. --- drape_frontend/area_shape.cpp | 17 +++-------------- drape_frontend/area_shape.hpp | 3 +-- drape_frontend/read_mwm_task.cpp | 5 ++--- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/drape_frontend/area_shape.cpp b/drape_frontend/area_shape.cpp index 05ee6f6c5d..b699c30d1b 100644 --- a/drape_frontend/area_shape.cpp +++ b/drape_frontend/area_shape.cpp @@ -5,21 +5,10 @@ namespace df { - AreaShape::AreaShape(const Color & c) + AreaShape::AreaShape(const Color & c, float depth) : m_color(c) - , m_depth(0.0f) - { - } - - void AreaShape::SetDepth(float depth) - { - if (m_depth != depth) - { - m_depth = depth; - for (size_t i = 0; i < m_vertexes.size() ; ++i) - m_vertexes[i].m_z = m_depth; - } - } + , m_depth(depth) + {} void AreaShape::AddTriangle(const m2::PointF & v1, const m2::PointF & v2, diff --git a/drape_frontend/area_shape.hpp b/drape_frontend/area_shape.hpp index a47d55e0b4..d45539fd20 100644 --- a/drape_frontend/area_shape.hpp +++ b/drape_frontend/area_shape.hpp @@ -13,8 +13,7 @@ namespace df class AreaShape : public MapShape { public: - AreaShape(Color const & c); - void SetDepth(float depth); + AreaShape(Color const & c, float depth); void AddTriangle(const m2::PointF & v1, const m2::PointF & v2, diff --git a/drape_frontend/read_mwm_task.cpp b/drape_frontend/read_mwm_task.cpp index 8061a841f4..1cfe22c716 100644 --- a/drape_frontend/read_mwm_task.cpp +++ b/drape_frontend/read_mwm_task.cpp @@ -8,8 +8,7 @@ namespace { df::AreaShape * CreateFakeShape1() { - df::AreaShape * shape = new df::AreaShape(Extract(0xFFEEAABB)); - shape->SetDepth(0.3f); + df::AreaShape * shape = new df::AreaShape(Extract(0xFFEEAABB), 0.3f); shape->AddTriangle(m2::PointF(0.0f, 0.0f), m2::PointF(1.0f, 0.0f), m2::PointF(0.0f, 1.0f)); @@ -22,7 +21,7 @@ namespace df::AreaShape * CreateFakeShape2() { - df::AreaShape * shape = new df::AreaShape(Extract(0xFF66AAFF)); + df::AreaShape * shape = new df::AreaShape(Extract(0xFF66AAFF), 0.0f); shape->AddTriangle(m2::PointF(-0.5f, 0.5f), m2::PointF(0.5f, 1.5f), m2::PointF(0.5f, -0.5f));