mirror of
https://github.com/libretro/mgba.git
synced 2024-11-23 16:10:01 +00:00
Util: Strip loading 16-bit PNGs down to 8-bit
This commit is contained in:
parent
542792215e
commit
cb0ad844c1
@ -279,6 +279,14 @@ bool PNGReadPixels(png_structp png, png_infop info, void* pixels, unsigned width
|
||||
return false;
|
||||
}
|
||||
|
||||
if (png_get_bit_depth(png, info) == 16) {
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
png_set_scale_16(png);
|
||||
#else
|
||||
png_set_strip_16(png);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t* pixelData = pixels;
|
||||
unsigned pngHeight = png_get_image_height(png, info);
|
||||
if (height < pngHeight) {
|
||||
@ -334,6 +342,14 @@ bool PNGReadPixelsA(png_structp png, png_infop info, void* pixels, unsigned widt
|
||||
return false;
|
||||
}
|
||||
|
||||
if (png_get_bit_depth(png, info) == 16) {
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
png_set_scale_16(png);
|
||||
#else
|
||||
png_set_strip_16(png);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t* pixelData = pixels;
|
||||
unsigned pngHeight = png_get_image_height(png, info);
|
||||
if (height < pngHeight) {
|
||||
@ -389,6 +405,14 @@ bool PNGReadPixels8(png_structp png, png_infop info, void* pixels, unsigned widt
|
||||
return false;
|
||||
}
|
||||
|
||||
if (png_get_bit_depth(png, info) == 16) {
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
png_set_scale_16(png);
|
||||
#else
|
||||
png_set_strip_16(png);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t* pixelData = pixels;
|
||||
unsigned pngHeight = png_get_image_height(png, info);
|
||||
if (height < pngHeight) {
|
||||
|
Loading…
Reference in New Issue
Block a user