| 283 | |
| 284 | private: |
| 285 | static void moveNext(PatchControlIterator& it, const IPatch& patch, std::size_t endRow, int rowDelta, int columnDelta) |
| 286 | { |
| 287 | auto nextColumn = it.getColumn() + columnDelta; |
| 288 | auto nextRow = it.getRow(); |
| 289 | |
| 290 | if (columnDelta > 0 && nextColumn >= patch.getWidth() || |
| 291 | columnDelta < 0 && nextColumn < 0) |
| 292 | { |
| 293 | // Advance to the next row |
| 294 | // If that doesn't succeed, just leave the indices out of bounds |
| 295 | nextRow += rowDelta; |
| 296 | |
| 297 | if (rowDelta > 0 && nextRow <= endRow || |
| 298 | rowDelta < 0 && nextRow >= endRow) |
| 299 | { |
| 300 | nextColumn = columnDelta > 0 ? 0 : static_cast<int>(patch.getWidth()) - 1; |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | it.set(nextRow, nextColumn); |
| 305 | } |
| 306 | }; |
| 307 | |
| 308 | // An iterator traversing a given patch row-wise, iterating over |