Disabled support for grayscale images with bit depths less than 8. This is because libpng does not support these images when it does gray to RGB conversion. Will need to enhance libpng or add workarounds to PNGTranslator to fix this issue.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7260 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber 2004-04-20 19:59:10 +00:00
parent da766ff5ee
commit 9f33f8e014
1 changed files with 8 additions and 0 deletions

View File

@ -325,6 +325,14 @@ PNGTranslator::translate_from_png_to_bits(BPositionIO *inSource,
int bit_depth, color_type, interlace_type;
png_get_IHDR(ppng, pinfo, &width, &height, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL);
if ((color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) && bit_depth < 8) {
// libpng's gray to RGB conversion is not implemented
// for bit depths less than 8
result = B_NO_TRANSLATOR;
break;
}
// Setup image transformations to make converting it easier
bool balpha = false;