mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
picviewer/png: always strip alpha channel
newer libpng (1.2.40+ at least) seems to always deliver an alpha
channel for 8bit paletted pics, but not always set PNG_COLOR_MASK_ALPHA
=> always strip alpha channel to fix this
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@268 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Branch: ni/coolstream
Commit: b016250bc5
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2010-02-06 (Sat, 06 Feb 2010)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -78,8 +78,11 @@ int fh_png_load(const char *name,unsigned char **buffer,int* /*xp*/,int* /*yp*/)
|
||||
png_set_background(png_ptr, (png_color_16*)&my_background, PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
||||
}
|
||||
|
||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
||||
png_set_strip_alpha(png_ptr);
|
||||
/* this test does not trigger for 8bit-paletted PNGs with newer libpng (1.2.40 at least),
|
||||
but the data delivered is with alpha channel anyway, so always strip alpha for now
|
||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
||||
*/
|
||||
png_set_strip_alpha(png_ptr);
|
||||
|
||||
if (bit_depth < 8)
|
||||
png_set_packing(png_ptr);
|
||||
@@ -98,6 +101,7 @@ int fh_png_load(const char *name,unsigned char **buffer,int* /*xp*/,int* /*yp*/)
|
||||
if (width * 3 != png_get_rowbytes(png_ptr, info_ptr))
|
||||
{
|
||||
printf("[png.cpp]: Error processing %s - please report (including image).\n", name);
|
||||
printf(" width: %d rowbytes: %d\n", width, png_get_rowbytes(png_ptr, info_ptr));
|
||||
fclose(fh);
|
||||
return(FH_ERROR_FORMAT);
|
||||
}
|
||||
|
Reference in New Issue
Block a user