Fix ImageSource not rendering across world copies (#4508)

This commit is contained in:
Taku Fukada
2026-08-28 11:48:01 +09:00
committed by GitHub
parent cbe4681ef1
commit c3b588321b
6 changed files with 67 additions and 8 deletions

View File

@@ -29,6 +29,7 @@
### 🐞 Bug fixes ### 🐞 Bug fixes
- *...Add new stuff here...* - *...Add new stuff here...*
- [core] Fix `ImageSource` not rendering across world copies ([#4508](https://github.com/maplibre/maplibre-native/issues/4508)).
- [core] Repaint data-driven symbol paint properties after feature-state updates. - [core] Repaint data-driven symbol paint properties after feature-state updates.
- [core] Accept alpha values in legacy comma-separated `hsl()` colors ([#4434](https://github.com/maplibre/maplibre-native/issues/4434)). - [core] Accept alpha values in legacy comma-separated `hsl()` colors ([#4434](https://github.com/maplibre/maplibre-native/issues/4434)).
- [core] Fix thread-unsafe headless OpenGL display singleton initialization [#4332](https://github.com/maplibre/maplibre-native/pull/4332) - [core] Fix thread-unsafe headless OpenGL display singleton initialization [#4332](https://github.com/maplibre/maplibre-native/pull/4332)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

View File

@@ -0,0 +1,56 @@
{
"version": 8,
"metadata": {
"test": {
"width": 256,
"height": 128
}
},
"center": [
180,
0
],
"zoom": 1,
"sources": {
"image": {
"type": "image",
"coordinates": [
[
-180,
85.05112878
],
[
180,
85.05112878
],
[
180,
-85.05112878
],
[
-180,
-85.05112878
]
],
"url": "local://image/world-wrap.png"
}
},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "#ff00ff"
}
},
{
"id": "image",
"type": "raster",
"source": "image",
"paint": {
"raster-fade-duration": 0,
"raster-resampling": "nearest"
}
}
]
}

View File

@@ -13,6 +13,8 @@
#include <mln/util/tile_coordinate.hpp> #include <mln/util/tile_coordinate.hpp>
#include <mln/util/tile_cover.hpp> #include <mln/util/tile_cover.hpp>
#include <algorithm>
namespace mln { namespace mln {
using namespace style; using namespace style;
@@ -142,15 +144,15 @@ void RenderImageSource::update(Immutable<style::Source::Impl> baseImpl_,
static_cast<uint8_t>(transformState.getZoom()), static_cast<uint8_t>(transformState.getZoom()),
zoomRange); zoomRange);
for (auto tile : idealTiles) { for (auto tile : idealTiles) {
if (tile.wrap != 0 && tileCover[0].canonical.isChildOf(tile.canonical)) { for (auto coveringTile : tileCover) {
tileIds.emplace_back(tile.wrap, tileCover[0].canonical); if (coveringTile.canonical == tile.canonical || coveringTile.canonical.isChildOf(tile.canonical) ||
hasVisibleTile = true; tile.canonical.isChildOf(coveringTile.canonical)) {
} else if (!hasVisibleTile) { hasVisibleTile = true;
for (auto coveringTile : tileCover) { const UnwrappedTileID wrappedTileID(tile.wrap, tileCover[0].canonical);
if (coveringTile.canonical == tile.canonical || coveringTile.canonical.isChildOf(tile.canonical) || if (tile.wrap != 0 && std::find(tileIds.cbegin(), tileIds.cend(), wrappedTileID) == tileIds.cend()) {
tile.canonical.isChildOf(coveringTile.canonical)) { tileIds.push_back(wrappedTileID);
hasVisibleTile = true;
} }
break;
} }
} }
} }