Skip to content

Conversation

@geneotech
Copy link
Contributor

@geneotech geneotech commented Jan 4, 2026

Description

The rectpack2D::find_best_packing function does not in fact alter the input container's order.
This is the only place the actual subjects argument is referenced in the rectpack2D::find_best_packing definition:

			auto& initial_pointers = orders[0];
			initial_pointers.clear();

			for (auto& s : subjects) {
				auto& r = s.get_rect();

				if (r.area() > 0) {
					initial_pointers.emplace_back(std::addressof(r));
				}
			}

The library allocates its own order arrays for each comparator, and manipulates these arrays, not the input container.
Since the input std::vector< QgsTextureRect > rects in generateAtlas is already generated using index++ for every subsequent element, there seems to be no need to ever sort these elements.

@github-actions github-actions bot added this to the 4.0.0 milestone Jan 4, 2026
@nyalldawson
Copy link
Collaborator

Can you also remove the id member from QgsTextureRect? That shouldn't be required anymore.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 421bca6)

🍎 MacOS Qt6 builds

Download MacOS Qt6 builds of this PR for testing.
This installer is not signed, control+click > open the app to avoid the warning
(Built from commit 421bca6)

@nyalldawson nyalldawson merged commit 5a247fa into qgis:master Jan 7, 2026
27 checks passed
@nyalldawson
Copy link
Collaborator

Thanks @geneotech !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants