stefanbeller/tiled — comment on commit c70cd73ee457f6cc812c09034ac3ed9e40d40405
File: src/tiled/utils.cpp line 87
By bjorn:

Doesn't this mean that, if a coherent rect is found and added to the region, `i` is removed so the rect at `i + 1` shifts to `i` and is then skipped since the next loop is after `++i`?

You can fiddle around with decrementing `i`, but I would iterate `rects` backwards to avoid this problem. That's even better since it means you don't need `numberOfRects`.