diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c2f59c8..4971f15f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15) cmake_policy(SET CMP0091 NEW) # enable new "MSVC runtime library selection" (https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html) project(libCZI - VERSION 0.55.0 + VERSION 0.55.1 HOMEPAGE_URL "https://github.com/ZEISS/libczi" DESCRIPTION "libCZI is an Open Source Cross-Platform C++ library to read and write CZI") diff --git a/Src/libCZI/Doc/version-history.markdown b/Src/libCZI/Doc/version-history.markdown index 5996d5c5..0926eb83 100644 --- a/Src/libCZI/Doc/version-history.markdown +++ b/Src/libCZI/Doc/version-history.markdown @@ -9,4 +9,5 @@ version history {#version_history} 0.54.0 | [71](https://github.com/ZEISS/libczi/pull/71) | introduce 'streamsLib', add curl-based stream class 0.54.2 | [74](https://github.com/ZEISS/libczi/pull/74) | minor bug fix 0.54.3 | [79](https://github.com/ZEISS/libczi/pull/79) | add option _kCurlHttp_FollowLocation_ to follow HTTP redirects tp curl_http_inputstream - 0.55.0 | [78](https://github.com/ZEISS/libczi/pull/78) | optimization: for multi-tile-composition, check relevant tiles for visibility before loading them (and do not load/decode non-visible tiles) \ No newline at end of file + 0.55.0 | [78](https://github.com/ZEISS/libczi/pull/78) | optimization: for multi-tile-composition, check relevant tiles for visibility before loading them (and do not load/decode non-visible tiles) + 0.55.1 | [80](https://github.com/ZEISS/libczi/pull/80) | bugfix for above optimization \ No newline at end of file diff --git a/Src/libCZI/SingleChannelAccessorBase.cpp b/Src/libCZI/SingleChannelAccessorBase.cpp index b0a9c815..8a4e5a9f 100644 --- a/Src/libCZI/SingleChannelAccessorBase.cpp +++ b/Src/libCZI/SingleChannelAccessorBase.cpp @@ -119,7 +119,7 @@ std::vector CSingleChannelAccessorBase::CheckForVisibility(const libCZI::In { // some pixels which were not overdrawn by all the previous ones // this means - when drawing this subblock, some new pixels will be covered which were not covered before, // so we need to draw this subblock, therefore we add it to our result vector - result.push_back(subblock_index); + result.push_back(i); covered_pixel_count = new_covered_pixel_count; if (new_covered_pixel_count == total_pixel_count) diff --git a/Src/libCZI_UnitTests/test_TileAccessorCoverageOptimization.cpp b/Src/libCZI_UnitTests/test_TileAccessorCoverageOptimization.cpp index 037020d9..e4e3d0a6 100644 --- a/Src/libCZI_UnitTests/test_TileAccessorCoverageOptimization.cpp +++ b/Src/libCZI_UnitTests/test_TileAccessorCoverageOptimization.cpp @@ -582,3 +582,29 @@ TEST(TileAccessorCoverageOptimization, CheckForVisibility_TestCase4) EXPECT_EQ(indices_of_visible_tiles[0], 1); EXPECT_EQ(indices_of_visible_tiles[1], 5); } + +TEST(TileAccessorCoverageOptimization, CheckForVisibility_TestCase5) +{ + static constexpr array kSubBlocks{ IntRect{0,0,1,1}, IntRect{0,0,1,1}, IntRect{1,0,1,2}, IntRect{2,0,3,3}, IntRect{2,0,1,1}, IntRect{1,0,2,3} }; + + // the function CheckForVisibilityCore is supposed to return a vector with indices "as they are used to call into + // 'get_subblock_index'-functor" (**not** the subblock-index as returned from this functor). We check this here by + // returning a "non-zero-based"-index from the functor, where we then check that the returned vector contains the + // correct results according to above rule (and the function's documentation). + + const auto indices_of_visible_tiles = CSingleChannelAccessorBaseToTestStub::CheckForVisibilityCore( + { 0, 0, 3, 3 }, + kSubBlocks.size(), + [&](int index)->int + { + return index + 10; + }, + [&](int subblock_index)->IntRect + { + return kSubBlocks[subblock_index - 10]; + }); + + ASSERT_EQ(indices_of_visible_tiles.size(), 2); + EXPECT_EQ(indices_of_visible_tiles[0], 1); + EXPECT_EQ(indices_of_visible_tiles[1], 5); +}