mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-10-05 21:49:28 +03:00
8b17e2ef62
Before this commit loadPNG() could return any surface format and the caller was responsible for converting it to the desired format. However, in practice all callers want a surface with an alpha channel and SDL only supports that with 32bpp surfaces, so RGBA or a permutation thereof. So I changed the contract for loadPNG() so it is required to return an RGBA surface, and removed the conversion code in the callers. The next step is to replace IMG_Load() by a function that calls libpng directly and loads a fixed 32bpp pixel format. That way, we can drop the SDL_image dependency and avoid unnecessary pixel format conversions.
13 lines
215 B
C++
13 lines
215 B
C++
#ifndef IMAGEIO_H
|
|
#define IMAGEIO_H
|
|
|
|
#include <string>
|
|
|
|
struct SDL_Surface;
|
|
|
|
/** Loads an image from a PNG file into a newly allocated 32bpp RGBA surface.
|
|
*/
|
|
SDL_Surface *loadPNG(const std::string &path);
|
|
|
|
#endif
|