| 70 | } |
| 71 | |
| 72 | SDL_Surface* loadFromMemory(const u8* buffer, size_t size) |
| 73 | { |
| 74 | SDL_RWops* memops = SDL_RWFromConstMem(buffer, (s32)size); |
| 75 | if (!memops) |
| 76 | return nullptr; |
| 77 | |
| 78 | SDL_Surface* sdlimg = IMG_Load_RW(memops, 1); |
| 79 | if (!sdlimg) |
| 80 | return nullptr; |
| 81 | if (sdlimg->format->BitsPerPixel != 32) |
| 82 | sdlimg = convertToRGBA(sdlimg); |
| 83 | if (!sdlimg) |
| 84 | return nullptr; |
| 85 | |
| 86 | return sdlimg; |
| 87 | } |
| 88 | |
| 89 | SDL_Surface* get(const char* imagePath) |
| 90 | { |
no test coverage detected