Commit 2ce662fe authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

Fixed PBM loader, width/height was swapped...

parent fda7e6c1
...@@ -685,7 +685,9 @@ static void loadPBM(const char *filename, PBM* img) ...@@ -685,7 +685,9 @@ static void loadPBM(const char *filename, PBM* img)
while (fgetc(f) != '\n') while (fgetc(f) != '\n')
; ;
int size = img->width * (img->height / 8 + 1); // The number of bytes per row is width / 8 rounded upwards.
// So the total number of bytes is height * ceil(width / 8)
int size = img->height * (img->width / 8 + 1);
img->data = new unsigned char[size]; img->data = new unsigned char[size];
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment