diff --git a/drape/glstate.cpp b/drape/glstate.cpp index a9d79758cd..c402930cc3 100644 --- a/drape/glstate.cpp +++ b/drape/glstate.cpp @@ -105,6 +105,7 @@ bool GLState::operator==(const GLState & other) const m_depthLayer == other.m_depthLayer && m_gpuProgramIndex == other.m_gpuProgramIndex && m_textureSet == other.m_textureSet && + m_blending == other.m_blending && m_color == other.m_color; } diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index f5409ba219..c5b39f73d5 100644 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -249,7 +249,7 @@ namespace df double const range = MercatorBounds::maxX - MercatorBounds::minX; double const rectSize = range / (1 << tileScale); - m2::RectD const & clipRect = m_view.ClipRect(); + m2::RectD const & clipRect = m_view.ClipRect(); int const minTileX = static_cast(floor(clipRect.minX() / rectSize)); int const maxTileX = static_cast(ceil(clipRect.maxX() / rectSize)); diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp index 348f2bb5b5..6fe8e8621b 100644 --- a/drape_frontend/message_subclasses.hpp +++ b/drape_frontend/message_subclasses.hpp @@ -100,7 +100,7 @@ namespace df class UpdateReadManagerMessage : public UpdateModelViewMessage { public: - UpdateReadManagerMessage(ScreenBase const & screen, shared_ptr > tiles) + UpdateReadManagerMessage(ScreenBase const & screen, shared_ptr > const & tiles) : UpdateModelViewMessage(screen) , m_tiles(tiles) { diff --git a/drape_frontend/render_group.cpp b/drape_frontend/render_group.cpp index 8d6e178e05..cfc6a053c3 100644 --- a/drape_frontend/render_group.cpp +++ b/drape_frontend/render_group.cpp @@ -6,94 +6,97 @@ namespace df { - namespace - { - RenderBucket * NonConstGetter(MasterPointer & p) - { - return p.GetRaw(); - } - } +namespace +{ - RenderGroup::RenderGroup(GLState const & state, df::TileKey const & tileKey) - : m_state(state) - , m_tileKey(tileKey) - , m_pendingOnDelete(false) - { - } - - RenderGroup::~RenderGroup() - { - (void)GetRangeDeletor(m_renderBuckets, MasterPointerDeleter())(); - } - - void RenderGroup::CollectOverlay(RefPointer tree) - { - for_each(m_renderBuckets.begin(), m_renderBuckets.end(), bind(&RenderBucket::CollectOverlayHandles, - bind(&NonConstGetter, _1), - tree)); - } - - void RenderGroup::Render() - { - ASSERT(m_pendingOnDelete == false, ()); - for_each(m_renderBuckets.begin(), m_renderBuckets.end(), bind(&RenderBucket::Render, - bind(&NonConstGetter, _1))); - } - - void RenderGroup::PrepareForAdd(size_t countForAdd) - { - m_renderBuckets.reserve(m_renderBuckets.size() + countForAdd); - } - - void RenderGroup::AddBucket(TransferPointer bucket) - { - m_renderBuckets.push_back(MasterPointer(bucket)); - } - - bool RenderGroup::IsLess(RenderGroup const & other) const - { - return m_state < other.m_state; - } - - RenderBucketComparator::RenderBucketComparator(set const & activeTiles) - : m_activeTiles(activeTiles) - , m_needGroupMergeOperation(false) - , m_needBucketsMergeOperation(false) - { - } - - void RenderBucketComparator::ResetInternalState() - { - m_needBucketsMergeOperation = false; - m_needGroupMergeOperation = false; - } - - bool RenderBucketComparator::operator()(RenderGroup const * l, RenderGroup const * r) - { - GLState const & lState = l->GetState(); - GLState const & rState = r->GetState(); - - TileKey const & lKey = l->GetTileKey(); - TileKey const & rKey = r->GetTileKey(); - - if (!l->IsPendingOnDelete() && (l->IsEmpty() || m_activeTiles.find(lKey) == m_activeTiles.end())) - l->DeleteLater(); - - if (!r->IsPendingOnDelete() && (r->IsEmpty() || m_activeTiles.find(rKey) == m_activeTiles.end())) - r->DeleteLater(); - - bool lPendingOnDelete = l->IsPendingOnDelete(); - bool rPendingOnDelete = r->IsPendingOnDelete(); - - if (lState == rState && lKey == rKey && !lPendingOnDelete) - m_needGroupMergeOperation = true; - - if (rPendingOnDelete == lPendingOnDelete) - return lState < rState; - - if (rPendingOnDelete) - return true; - - return false; - } +RenderBucket * NonConstGetter(MasterPointer & p) +{ + return p.GetRaw(); } + +} /// namespace + +RenderGroup::RenderGroup(GLState const & state, df::TileKey const & tileKey) + : m_state(state) + , m_tileKey(tileKey) + , m_pendingOnDelete(false) +{ +} + +RenderGroup::~RenderGroup() +{ + (void)GetRangeDeletor(m_renderBuckets, MasterPointerDeleter())(); +} + +void RenderGroup::CollectOverlay(RefPointer tree) +{ + for_each(m_renderBuckets.begin(), m_renderBuckets.end(), bind(&RenderBucket::CollectOverlayHandles, + bind(&NonConstGetter, _1), + tree)); +} + +void RenderGroup::Render() +{ + ASSERT(m_pendingOnDelete == false, ()); + for_each(m_renderBuckets.begin(), m_renderBuckets.end(), bind(&RenderBucket::Render, + bind(&NonConstGetter, _1))); +} + +void RenderGroup::PrepareForAdd(size_t countForAdd) +{ + m_renderBuckets.reserve(m_renderBuckets.size() + countForAdd); +} + +void RenderGroup::AddBucket(TransferPointer bucket) +{ + m_renderBuckets.push_back(MasterPointer(bucket)); +} + +bool RenderGroup::IsLess(RenderGroup const & other) const +{ + return m_state < other.m_state; +} + +RenderBucketComparator::RenderBucketComparator(set const & activeTiles) + : m_activeTiles(activeTiles) + , m_needGroupMergeOperation(false) + , m_needBucketsMergeOperation(false) +{ +} + +void RenderBucketComparator::ResetInternalState() +{ + m_needBucketsMergeOperation = false; + m_needGroupMergeOperation = false; +} + +bool RenderBucketComparator::operator()(RenderGroup const * l, RenderGroup const * r) +{ + GLState const & lState = l->GetState(); + GLState const & rState = r->GetState(); + + TileKey const & lKey = l->GetTileKey(); + TileKey const & rKey = r->GetTileKey(); + + if (!l->IsPendingOnDelete() && (l->IsEmpty() || m_activeTiles.find(lKey) == m_activeTiles.end())) + l->DeleteLater(); + + if (!r->IsPendingOnDelete() && (r->IsEmpty() || m_activeTiles.find(rKey) == m_activeTiles.end())) + r->DeleteLater(); + + bool lPendingOnDelete = l->IsPendingOnDelete(); + bool rPendingOnDelete = r->IsPendingOnDelete(); + + if (lState == rState && lKey == rKey && !lPendingOnDelete) + m_needGroupMergeOperation = true; + + if (rPendingOnDelete == lPendingOnDelete) + return lState < rState; + + if (rPendingOnDelete) + return true; + + return false; +} + +} // namespace df diff --git a/drape_frontend/render_group.hpp b/drape_frontend/render_group.hpp index 3447c57531..a71b7e60f1 100644 --- a/drape_frontend/render_group.hpp +++ b/drape_frontend/render_group.hpp @@ -13,47 +13,49 @@ class OverlayTree; namespace df { - class RenderGroup - { - public: - RenderGroup(GLState const & state, TileKey const & tileKey); - ~RenderGroup(); - void CollectOverlay(RefPointer tree); - void Render(); +class RenderGroup +{ +public: + RenderGroup(GLState const & state, TileKey const & tileKey); + ~RenderGroup(); - void PrepareForAdd(size_t countForAdd); - void AddBucket(TransferPointer bucket); + void CollectOverlay(RefPointer tree); + void Render(); - GLState const & GetState() const { return m_state; } - TileKey const & GetTileKey() const { return m_tileKey; } + void PrepareForAdd(size_t countForAdd); + void AddBucket(TransferPointer bucket); - bool IsEmpty() const { return m_renderBuckets.empty(); } - void DeleteLater() const { m_pendingOnDelete = true; } - bool IsPendingOnDelete() const { return m_pendingOnDelete; } + GLState const & GetState() const { return m_state; } + TileKey const & GetTileKey() const { return m_tileKey; } - bool IsLess(RenderGroup const & other) const; + bool IsEmpty() const { return m_renderBuckets.empty(); } + void DeleteLater() const { m_pendingOnDelete = true; } + bool IsPendingOnDelete() const { return m_pendingOnDelete; } - private: - GLState m_state; - TileKey m_tileKey; - vector > m_renderBuckets; + bool IsLess(RenderGroup const & other) const; - mutable bool m_pendingOnDelete; - }; +private: + GLState m_state; + TileKey m_tileKey; + vector > m_renderBuckets; - class RenderBucketComparator - { - public: - RenderBucketComparator(set const & activeTiles); + mutable bool m_pendingOnDelete; +}; - void ResetInternalState(); +class RenderBucketComparator +{ +public: + RenderBucketComparator(set const & activeTiles); - bool operator()(RenderGroup const * l, RenderGroup const * r); + void ResetInternalState(); - private: - set const & m_activeTiles; - bool m_needGroupMergeOperation; - bool m_needBucketsMergeOperation; - }; -} + bool operator()(RenderGroup const * l, RenderGroup const * r); + +private: + set const & m_activeTiles; + bool m_needGroupMergeOperation; + bool m_needBucketsMergeOperation; +}; + +} // namespace df