rotateRow method
Rotates a specific row within the given bounds by amount rightward.
Implementation
void rotateRow(Rect bounds, int rowIndex, int amount) {
if (rowIndex < 0 || rowIndex >= bounds.height) return;
if (bounds.width <= 1) return;
amount = amount % bounds.width;
if (amount < 0) amount += bounds.width;
if (amount == 0) return;
final y = bounds.y + rowIndex;
if (y < 0 || y >= height) return;
final n = bounds.width;
_reverseRow(bounds.x, y, 0, n - 1);
_reverseRow(bounds.x, y, 0, amount - 1);
_reverseRow(bounds.x, y, amount, n - 1);
}