Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-06-18 19:16:51 +0300
committerJacques Lucke <jacques@blender.org>2020-06-18 19:18:19 +0300
commit52b8d668f4d3d0a841313b678027a2d6af2fbc37 (patch)
treefbebc123c8929c2d36ba72b0e1638daed4c93c99 /source/blender/depsgraph/intern/builder/deg_builder_map.cc
parent44f785266012cfc399f29d28f13717a317e7a348 (diff)
Depsgraph: use blender::Map instead of std::map
We decided to use our own map data structure in general for better readability and performance. Reviewers: sergey Differential Revision: https://developer.blender.org/D7987
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_map.cc')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_map.cc23
1 files changed, 5 insertions, 18 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.cc b/source/blender/depsgraph/intern/builder/deg_builder_map.cc
index 4bca4f037b0..d0bebd8b10a 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_map.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_map.cc
@@ -42,33 +42,20 @@ bool BuilderMap::checkIsBuilt(ID *id, int tag) const
void BuilderMap::tagBuild(ID *id, int tag)
{
- IDTagMap::iterator it = id_tags_.find(id);
- if (it == id_tags_.end()) {
- id_tags_.insert(make_pair(id, tag));
- return;
- }
- it->second |= tag;
+ id_tags_.lookup_or_add(id, 0) |= tag;
}
bool BuilderMap::checkIsBuiltAndTag(ID *id, int tag)
{
- IDTagMap::iterator it = id_tags_.find(id);
- if (it == id_tags_.end()) {
- id_tags_.insert(make_pair(id, tag));
- return false;
- }
- const bool result = (it->second & tag) == tag;
- it->second |= tag;
+ int &id_tag = id_tags_.lookup_or_add(id, 0);
+ const bool result = (id_tag & tag) == tag;
+ id_tag |= tag;
return result;
}
int BuilderMap::getIDTag(ID *id) const
{
- IDTagMap::const_iterator it = id_tags_.find(id);
- if (it == id_tags_.end()) {
- return 0;
- }
- return it->second;
+ return id_tags_.lookup_default(id, 0);
}
} // namespace DEG