MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / loadFromMemory

Function loadFromMemory

TheForceEngine/TFE_Asset/imageAsset.cpp:72–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

extractPosterFromImageFunction · 0.85

Calls 1

convertToRGBAFunction · 0.70

Tested by

no test coverage detected