| 76 | } |
| 77 | |
| 78 | void* BaseManager::loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename) |
| 79 | { |
| 80 | std::string fullname = MyGUI::OpenGLESDataManager::getInstance().getDataPath(_filename); |
| 81 | void* result = nullptr; |
| 82 | SDL_Surface* image = nullptr; |
| 83 | SDL_Surface* cvtImage = nullptr; // converted surface with RGBA/RGB pixel format |
| 84 | image = IMG_Load(fullname.c_str()); |
| 85 | MYGUI_ASSERT(image != nullptr, "Failed to load image: " + fullname); |
| 86 | |
| 87 | _width = image->w; |
| 88 | _height = image->h; |
| 89 | |
| 90 | int bpp = image->format->BytesPerPixel; |
| 91 | if (bpp < 3) |
| 92 | { |
| 93 | result = convertPixelData(image, _format); |
| 94 | } |
| 95 | else |
| 96 | { |
| 97 | Uint32 pixelFmt = bpp == 3 ? SDL_PIXELFORMAT_BGR24 : SDL_PIXELFORMAT_ARGB8888; |
| 98 | cvtImage = SDL_ConvertSurfaceFormat(image, pixelFmt, 0); |
| 99 | result = convertPixelData(cvtImage, _format); |
| 100 | SDL_FreeSurface(cvtImage); |
| 101 | } |
| 102 | SDL_FreeSurface(image); |
| 103 | |
| 104 | return result; |
| 105 | } |
| 106 | |
| 107 | void BaseManager::saveImage( |
| 108 | int _width, |
nothing calls this directly
no test coverage detected