summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/algorithm/generate_clip_ids.cpp16
-rw-r--r--src/mbgl/algorithm/generate_clip_ids.hpp2
-rw-r--r--src/mbgl/renderer/painter.cpp6
-rw-r--r--test/algorithm/generate_clip_ids.test.cpp54
4 files changed, 39 insertions, 39 deletions
diff --git a/src/mbgl/algorithm/generate_clip_ids.cpp b/src/mbgl/algorithm/generate_clip_ids.cpp
index 74e0ee242f..287d2a408e 100644
--- a/src/mbgl/algorithm/generate_clip_ids.cpp
+++ b/src/mbgl/algorithm/generate_clip_ids.cpp
@@ -31,14 +31,14 @@ bool ClipIDGenerator::Leaf::operator==(const Leaf& other) const {
return children == other.children;
}
-std::map<UnwrappedTileID, ClipID> ClipIDGenerator::getStencils() const {
- std::map<UnwrappedTileID, ClipID> stencils;
+std::map<UnwrappedTileID, ClipID> ClipIDGenerator::getClipIDs() const {
+ std::map<UnwrappedTileID, ClipID> clipIDs;
// Merge everything.
for (auto& pair : pool) {
auto& id = pair.first;
auto& leaf = pair.second;
- auto res = stencils.emplace(id, leaf.clip);
+ auto res = clipIDs.emplace(id, leaf.clip);
if (!res.second) {
// Merge with the existing ClipID when there was already an element with the
// same tile ID.
@@ -46,14 +46,14 @@ std::map<UnwrappedTileID, ClipID> ClipIDGenerator::getStencils() const {
}
}
- for (auto it = stencils.begin(); it != stencils.end(); ++it) {
+ for (auto it = clipIDs.begin(); it != clipIDs.end(); ++it) {
auto& childId = it->first;
auto& childClip = it->second;
// Loop through all preceding stencils, and find all parents.
for (auto parentIt = std::reverse_iterator<decltype(it)>(it);
- parentIt != stencils.rend(); ++parentIt) {
+ parentIt != clipIDs.rend(); ++parentIt) {
auto& parentId = parentIt->first;
if (childId.isChildOf(parentId)) {
// Once we have a parent, we add the bits that this ID hasn't set yet.
@@ -66,11 +66,11 @@ std::map<UnwrappedTileID, ClipID> ClipIDGenerator::getStencils() const {
}
// Remove tiles that are entirely covered by children.
- util::erase_if(stencils, [&](const auto& stencil) {
- return algorithm::coveredByChildren(stencil.first, stencils);
+ util::erase_if(clipIDs, [&](const auto& stencil) {
+ return algorithm::coveredByChildren(stencil.first, clipIDs);
});
- return stencils;
+ return clipIDs;
}
} // namespace algorithm
diff --git a/src/mbgl/algorithm/generate_clip_ids.hpp b/src/mbgl/algorithm/generate_clip_ids.hpp
index 8338c7c145..adcf87a72a 100644
--- a/src/mbgl/algorithm/generate_clip_ids.hpp
+++ b/src/mbgl/algorithm/generate_clip_ids.hpp
@@ -28,7 +28,7 @@ public:
template <typename Renderable>
void update(std::vector<std::reference_wrapper<Renderable>> renderables);
- std::map<UnwrappedTileID, ClipID> getStencils() const;
+ std::map<UnwrappedTileID, ClipID> getClipIDs() const;
};
} // namespace algorithm
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index 47db8254e2..a3decdb603 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -198,9 +198,9 @@ void Painter::render(RenderStyle& style, const FrameData& frame_, View& view) {
MBGL_DEBUG_GROUP(context, "clipping masks");
- for (const auto& stencil : clipIDGenerator.getStencils()) {
- MBGL_DEBUG_GROUP(context, std::string{ "mask: " } + util::toString(stencil.first));
- renderClippingMask(stencil.first, stencil.second);
+ for (const auto& clipID : clipIDGenerator.getClipIDs()) {
+ MBGL_DEBUG_GROUP(context, std::string{ "mask: " } + util::toString(clipID.first));
+ renderClippingMask(clipID.first, clipID.second);
}
}
diff --git a/test/algorithm/generate_clip_ids.test.cpp b/test/algorithm/generate_clip_ids.test.cpp
index 404ab79912..46a577b994 100644
--- a/test/algorithm/generate_clip_ids.test.cpp
+++ b/test/algorithm/generate_clip_ids.test.cpp
@@ -40,15 +40,15 @@ TEST(GenerateClipIDs, ParentAndFourChildren) {
}),
renderables);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
// 0/0/0 is missing because it is covered by children.
{ UnwrappedTileID{ 1, 0, 0 }, ClipID{ "00000111", "00000010" } },
{ UnwrappedTileID{ 1, 0, 1 }, ClipID{ "00000111", "00000011" } },
{ UnwrappedTileID{ 1, 1, 0 }, ClipID{ "00000111", "00000100" } },
{ UnwrappedTileID{ 1, 1, 1 }, ClipID{ "00000111", "00000101" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, ParentAndFourChildrenNegative) {
@@ -72,14 +72,14 @@ TEST(GenerateClipIDs, ParentAndFourChildrenNegative) {
}),
renderables);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 1, -2, 0 }, ClipID{ "00000111", "00000010" } },
{ UnwrappedTileID{ 1, -2, 1 }, ClipID{ "00000111", "00000011" } },
{ UnwrappedTileID{ 1, -1, 0 }, ClipID{ "00000111", "00000100" } },
{ UnwrappedTileID{ 1, -1, 1 }, ClipID{ "00000111", "00000101" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, NegativeParentAndMissingLevel) {
@@ -103,14 +103,14 @@ TEST(GenerateClipIDs, NegativeParentAndMissingLevel) {
}),
renderables);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 2, -2, 0 }, ClipID{ "00000111", "00000010" } },
{ UnwrappedTileID{ 2, -2, 1 }, ClipID{ "00000111", "00000011" } },
{ UnwrappedTileID{ 2, -1, 0 }, ClipID{ "00000111", "00000100" } },
{ UnwrappedTileID{ 2, -1, 1 }, ClipID{ "00000111", "00000101" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, SevenOnSameLevel) {
@@ -140,8 +140,8 @@ TEST(GenerateClipIDs, SevenOnSameLevel) {
}),
renderables);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 2, 0, 0 }, ClipID{ "00000111", "00000001" } },
{ UnwrappedTileID{ 2, 0, 1 }, ClipID{ "00000111", "00000010" } },
{ UnwrappedTileID{ 2, 0, 2 }, ClipID{ "00000111", "00000011" } },
@@ -150,7 +150,7 @@ TEST(GenerateClipIDs, SevenOnSameLevel) {
{ UnwrappedTileID{ 2, 1, 2 }, ClipID{ "00000111", "00000110" } },
{ UnwrappedTileID{ 2, 2, 0 }, ClipID{ "00000111", "00000111" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, MultipleLevels) {
@@ -193,8 +193,8 @@ TEST(GenerateClipIDs, MultipleLevels) {
}),
renderables);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 2, 1, 0 }, ClipID{ "00001111", "00000010" } },
{ UnwrappedTileID{ 3, 0, 0 }, ClipID{ "00001111", "00000011" } },
{ UnwrappedTileID{ 3, 1, 0 }, ClipID{ "00001111", "00000101" } },
@@ -206,7 +206,7 @@ TEST(GenerateClipIDs, MultipleLevels) {
{ UnwrappedTileID{ 4, 1, 2 }, ClipID{ "00001111", "00001011" } },
{ UnwrappedTileID{ 4, 1, 3 }, ClipID{ "00001111", "00001100" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, Bug206) {
@@ -244,8 +244,8 @@ TEST(GenerateClipIDs, Bug206) {
}),
renderables);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 10, 162, 395 }, ClipID{ "00001111", "00000001" } },
{ UnwrappedTileID{ 10, 162, 396 }, ClipID{ "00001111", "00000010" } },
{ UnwrappedTileID{ 10, 163, 395 }, ClipID{ "00001111", "00000011" } },
@@ -258,7 +258,7 @@ TEST(GenerateClipIDs, Bug206) {
{ UnwrappedTileID{ 12, 655, 1582 }, ClipID{ "00001111", "00001010" } },
{ UnwrappedTileID{ 12, 655, 1583 }, ClipID{ "00001111", "00001011" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, MultipleSources) {
@@ -312,8 +312,8 @@ TEST(GenerateClipIDs, MultipleSources) {
}),
renderables3);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 1, 0, 0 }, ClipID{ "11111111", "00101001" } },
{ UnwrappedTileID{ 1, 0, 1 }, ClipID{ "11111111", "01001001" } },
{ UnwrappedTileID{ 1, 1, 0 }, ClipID{ "11111111", "01101001" } },
@@ -322,7 +322,7 @@ TEST(GenerateClipIDs, MultipleSources) {
{ UnwrappedTileID{ 2, 2, 1 }, ClipID{ "11111111", "01101011" } },
{ UnwrappedTileID{ 2, 2, 2 }, ClipID{ "11111111", "10000100" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, DuplicateIDs) {
@@ -351,12 +351,12 @@ TEST(GenerateClipIDs, DuplicateIDs) {
}),
renderables2);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 2, 0, 0 }, ClipID{ "00000011", "00000001" } },
{ UnwrappedTileID{ 2, 0, 1 }, ClipID{ "00000011", "00000010" } },
}),
- stencils);
+ clipIDs);
}
TEST(GenerateClipIDs, SecondSourceHasParentOfFirstSource) {
@@ -390,10 +390,10 @@ TEST(GenerateClipIDs, SecondSourceHasParentOfFirstSource) {
}),
renderables3);
- const auto stencils = generator.getStencils();
- EXPECT_EQ(decltype(stencils)({
+ const auto clipIDs = generator.getClipIDs();
+ EXPECT_EQ(decltype(clipIDs)({
{ UnwrappedTileID{ 0, 0, 0 }, ClipID{ "00000110", "00000110" } },
{ UnwrappedTileID{ 1, 0, 0 }, ClipID{ "00000111", "00000101" } },
}),
- stencils);
+ clipIDs);
}