MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / loadRgbaSurface

Method loadRgbaSurface

src/she/sdl2/she.cpp:877–887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875 }
876
877 Surface* loadRgbaSurface(const char* filename) override {
878 SDL_Surface* bmp = IMG_Load(filename);
879 if (!bmp)
880 throw std::runtime_error(std::string{"Error loading image "} + filename);
881 if (bmp->format->BitsPerPixel < 32) {
882 auto copy = SDL_ConvertSurfaceFormat(bmp, SDL_PIXELFORMAT_RGBA8888, 0);
883 SDL_FreeSurface(bmp);
884 bmp = copy;
885 }
886 return new SDL2Surface(bmp, SDL2Surface::DeleteAndDestroy);
887 }
888
889 };
890

Callers 4

create_main_displayFunction · 0.80
loadSheetMethod · 0.80
onLoadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected