WIP [drape] Re-enable overlays bucket discard optimization

This commit is contained in:
Konstantin Pastbin 2023-09-03 17:10:33 +03:00
parent 2ac04082cb
commit 51d9441a20
5 changed files with 17 additions and 3 deletions

View file

@ -499,9 +499,9 @@ void RuleDrawer::operator()(FeatureType & f)
}
#endif
/// @todo Remove passing of minVisibleScale arg everywhere.
int minVisibleScale = 0;
auto insertShape = [this, &minVisibleScale](drape_ptr<MapShape> && shape)
//int const minVisibleScale = feature::GetMinDrawableScale(f); // original version
int const minVisibleScale = s.m_minOverlaysZoom; // lighter weight version
auto insertShape = [this, minVisibleScale](drape_ptr<MapShape> && shape)
{
size_t const index = shape->GetType();
ASSERT_LESS(index, m_mapShapes.size(), ());

View file

@ -403,6 +403,9 @@ bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool b
}
}
if (mainOverlayType != 0)
s.m_minOverlaysZoom = cl.GetObject(mainOverlayType)->GetMinOverlaysZoom();
feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys);
if (keys.empty())

View file

@ -55,6 +55,7 @@ public:
bool m_areaStyleExists = false;
bool m_lineStyleExists = false;
bool m_pointStyleExists = false;
int m_minOverlaysZoom = 0;
public:
CaptionDescription const & GetCaptionDescription() const;

View file

@ -54,6 +54,11 @@ void ClassifObject::AddDrawRule(drule::Key const & k)
if (k == *i)
return; // already exists
m_drawRules.insert(i, k);
if ((k.m_scale < m_minOverlaysZoom || m_minOverlaysZoom == 0) &&
(k.m_type == drule::symbol || k.m_type == drule::caption ||
k.m_type == drule::shield || k.m_type == drule::pathtext))
m_minOverlaysZoom = k.m_scale;
}
ClassifObjectPtr ClassifObject::BinaryFind(std::string_view const s) const

View file

@ -90,6 +90,9 @@ public:
std::vector<drule::Key> const & GetDrawRules() const { return m_drawRules; }
void GetSuitable(int scale, feature::GeomType gt, drule::KeysT & keys) const;
// Returns 0 if there are no overlay drules.
uint8_t GetMinOverlaysZoom() const { return m_minOverlaysZoom; }
bool IsDrawable(int scale) const;
bool IsDrawableAny() const;
bool IsDrawableLike(feature::GeomType gt, bool emptyName = false) const;
@ -161,6 +164,8 @@ private:
std::vector<drule::Key> m_drawRules;
std::vector<ClassifObject> m_objs;
VisibleMask m_visibility;
uint8_t m_minOverlaysZoom = 0;
};
inline void swap(ClassifObject & r1, ClassifObject & r2)