| 13 | } |
| 14 | |
| 15 | int LoadImage(FILE* f, surface_t* surface){ |
| 16 | char sig[8]; |
| 17 | fseek(f, 0, SEEK_SET); |
| 18 | |
| 19 | if(fread(sig, 8, 1, f) <= 0) { |
| 20 | return -2; // Could not read first 8 bytes of image |
| 21 | } |
| 22 | |
| 23 | int type = IdentifyImage(sig); |
| 24 | |
| 25 | if(type == Image_BMP){ |
| 26 | return LoadBitmapImage(f, surface); |
| 27 | } else if(type == Image_PNG){ |
| 28 | return LoadPNGImage(f, surface); |
| 29 | } else return -1; |
| 30 | } |
| 31 | |
| 32 | int LoadImage(const char* path, surface_t* surface){ |
| 33 | FILE* imageFile = fopen(path, "rb"); |
no test coverage detected