|
diff --git a/ppm.c b/ppm.c
|
| ... |
| 6 |
#include <string.h> |
6 |
#include <string.h> |
| 7 |
|
7 |
|
| 8 |
Image read_ppm_image(const char *filename) { |
8 |
Image read_ppm_image(const char *filename) { |
| 9 |
/* const char *filename = "textures/test.ppm"; */ |
|
|
| 10 |
|
|
|
| 11 |
Image img = {0}; |
9 |
Image img = {0}; |
| 12 |
|
10 |
|
| 13 |
FILE *f = fopen(filename, "rb"); |
11 |
FILE *f = fopen(filename, "rb"); |
| ... |
| 15 |
perror("fopen"); |
13 |
perror("fopen"); |
| 16 |
return (Image){}; |
14 |
return (Image){}; |
| 17 |
} |
15 |
} |
| 18 |
|
|
|
| 19 |
|
16 |
|
| 20 |
int j = 0; |
17 |
int j = 0; |
| 21 |
int in_token = 0; |
18 |
int in_token = 0; |
| ... |
| 94 |
|
91 |
|
| 95 |
fclose(f); |
92 |
fclose(f); |
| 96 |
|
93 |
|
| 97 |
printf("format: %s\n", img.format); |
94 |
printf("Loading image: [%s] %s (%dx%d) %d (%zu/%zu)\n", filename, img.format, img.width, img.height, img.color_space, pixel_count, pixel_capacity); |
| 98 |
printf("width: %d\n", img.width); |
|
|
| 99 |
printf("height: %d\n", img.height); |
|
|
| 100 |
printf("color_space: %d\n", img.color_space); |
|
|
| 101 |
printf("pixel_count: %zu\n", pixel_count); |
|
|
| 102 |
printf("expected: %zu\n", pixel_capacity); |
|
|
| 103 |
|
95 |
|
| 104 |
return img; |
96 |
return img; |
| 105 |
} |
97 |
} |