Skip to content

Commit 96e0e07

Browse files
committed
Rotating was unnecessary
Only reversing the rows did the trick
1 parent f462df3 commit 96e0e07

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bmp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ unsigned char* loadBMP(char* filename, DIBHeader* DIBitmapHeader) {
6868
bitmapImage[imageIdx + 2] = tempRGB;
6969
}
7070

71-
// Rotate 180 Degrees
71+
// Reverse the rows
7272
const int32_t rows = DIBitmapHeader->imgHeight;
7373
const int32_t cols = DIBitmapHeader->imgWidth;
7474
for (int j = 0; j < rows / 2 ; j++) {
7575
for (int i = 0; i < cols; i++) {
7676
int idxFrom = (j * cols + i) * increment;
77-
int idxTo = ((rows - j - 1) * cols + (cols - i - 1)) * increment;
77+
int idxTo = ((rows - j - 1) * cols + i) * increment;
7878

7979
int offset;
8080
for (offset = 0; offset < increment; offset++) {

0 commit comments

Comments
 (0)