You don't need to trace each diagonal separately. For every cell (r, c), check if it equals (r-1, c-1). If every cell matches its top-left neighbor, all diagonals are constant.
Skip the first row and first column in your scan since those cells have no top-left neighbor. If any cell doesn't match, return false immediately.
This one-pass approach avoids the complexity of tracking individual diagonals.