From 301dfafabfb4bb4f3cb6fdb3b80434c07c4993b3 Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Wed, 28 Sep 2022 05:52:59 -0400 Subject: [PATCH] Change the traversal of texture so the full image is displayed correctly on the globe --- .../src/tileprovider/ffmpegtileprovider.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/globebrowsing/src/tileprovider/ffmpegtileprovider.cpp b/modules/globebrowsing/src/tileprovider/ffmpegtileprovider.cpp index 9058e563e3..eeaa170e5d 100644 --- a/modules/globebrowsing/src/tileprovider/ffmpegtileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/ffmpegtileprovider.cpp @@ -228,12 +228,15 @@ Tile FfmpegTileProvider::tile(const TileIndex& tileIndex) { // Copy every row inside the part of the texture we want for the tile GLubyte* destination = &_tilePixels[0]; GLubyte* source = &_glFrame->data[0][0]; - for (int row = rowRange.x; row < rowRange.y; ++row) { + // Traverse backwards so texture is placed correctly + for (int row = rowRange.y - 1; row > rowRange.x; --row) { // Find index of first item of this row - int index = row * wholeRowSize; + int rowIndex = row * wholeRowSize; + // Find index of the first item of this column + int columnIndex = tileRowSize * tileIndex.x; // Copy - memcpy(destination, source + index, tileRowSize); + memcpy(destination, source + rowIndex + columnIndex, tileRowSize); // Advance the destination pointer destination += tileRowSize;