summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-11-29 12:50:10 -0800
committerChris Loer <chris.loer@mapbox.com>2018-11-30 12:30:50 -0800
commitf87ef3f72a6f2beda88bdc25dfbdeb169332603b (patch)
tree101a34d7ba78467ced9d9fdaa516717a2e6c6d87
parent01510619474d109e8eb80a4e328758007850dc72 (diff)
downloadqtlocation-mapboxgl-f87ef3f72a6f2beda88bdc25dfbdeb169332603b.tar.gz
[core] OverscaledTileID::isChildOf should check wrap values.
Fixes issue #13478
-rw-r--r--include/mbgl/tile/tile_id.hpp3
-rw-r--r--scripts/changelog_staging/tile-is-child.json4
-rw-r--r--test/tile/tile_id.test.cpp5
3 files changed, 10 insertions, 2 deletions
diff --git a/include/mbgl/tile/tile_id.hpp b/include/mbgl/tile/tile_id.hpp
index dd2fba573d..7371916449 100644
--- a/include/mbgl/tile/tile_id.hpp
+++ b/include/mbgl/tile/tile_id.hpp
@@ -181,7 +181,8 @@ inline uint32_t OverscaledTileID::overscaleFactor() const {
}
inline bool OverscaledTileID::isChildOf(const OverscaledTileID& rhs) const {
- return overscaledZ > rhs.overscaledZ &&
+ return wrap == rhs.wrap &&
+ overscaledZ > rhs.overscaledZ &&
(canonical == rhs.canonical || canonical.isChildOf(rhs.canonical));
}
diff --git a/scripts/changelog_staging/tile-is-child.json b/scripts/changelog_staging/tile-is-child.json
new file mode 100644
index 0000000000..1bc9227759
--- /dev/null
+++ b/scripts/changelog_staging/tile-is-child.json
@@ -0,0 +1,4 @@
+{
+ "core": "Fix OverscaledTileID::isChildOf to exclude tiles with different wrap. Incorrect child detection could cause flickering for symbols displaying in two wrapped world copies at the same time.",
+ "issue": 13478
+}
diff --git a/test/tile/tile_id.test.cpp b/test/tile/tile_id.test.cpp
index 2f328b78d7..f2de13653f 100644
--- a/test/tile/tile_id.test.cpp
+++ b/test/tile/tile_id.test.cpp
@@ -186,6 +186,7 @@ TEST(TileID, Overscaled) {
EXPECT_TRUE(OverscaledTileID(4, 2, 3).isChildOf(OverscaledTileID(3, 1, 1)));
EXPECT_TRUE(OverscaledTileID(5, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(3, 1, 1)));
EXPECT_TRUE(OverscaledTileID(6, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(3, 1, 1)));
+ EXPECT_FALSE(OverscaledTileID(6, -1, { 4, 2, 3 }).isChildOf(OverscaledTileID(3, 1, 1)));
EXPECT_TRUE(OverscaledTileID(7, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(3, 1, 1)));
EXPECT_FALSE(OverscaledTileID(2, 0, 0).isChildOf(OverscaledTileID(5, 0, { 4, 2, 3 })));
@@ -194,6 +195,7 @@ TEST(TileID, Overscaled) {
EXPECT_FALSE(OverscaledTileID(5, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(5, 0, { 4, 2, 3 })));
EXPECT_TRUE(OverscaledTileID(6, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(5, 0, { 4, 2, 3 })));
EXPECT_TRUE(OverscaledTileID(7, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(5, 0, { 4, 2, 3 })));
+ EXPECT_FALSE(OverscaledTileID(7, 1, { 4, 2, 3 }).isChildOf(OverscaledTileID(5, 0, { 4, 2, 3 })));
EXPECT_FALSE(OverscaledTileID(2, 0, 0).isChildOf(OverscaledTileID(6, 0, { 4, 2, 3 })));
EXPECT_FALSE(OverscaledTileID(3, 1, 1).isChildOf(OverscaledTileID(6, 0, { 4, 2, 3 })));
@@ -201,7 +203,8 @@ TEST(TileID, Overscaled) {
EXPECT_FALSE(OverscaledTileID(5, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(6, 0, { 4, 2, 3 })));
EXPECT_FALSE(OverscaledTileID(6, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(6, 0, { 4, 2, 3 })));
EXPECT_TRUE(OverscaledTileID(7, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(6, 0, { 4, 2, 3 })));
-
+ EXPECT_FALSE(OverscaledTileID(7, 0, { 4, 2, 3 }).isChildOf(OverscaledTileID(6, -1, { 4, 2, 3 })));
+
EXPECT_FALSE(OverscaledTileID(2, 0, 0).isChildOf(OverscaledTileID(5, 0, { 4, 0, 0 })));
EXPECT_FALSE(OverscaledTileID(3, 1, 1).isChildOf(OverscaledTileID(5, 0, { 4, 0, 0 })));
EXPECT_FALSE(OverscaledTileID(4, 2, 3).isChildOf(OverscaledTileID(5, 0, { 4, 0, 0 })));