aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-04-10 15:20:15 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-04-10 15:20:15 -0700
commite93773c42fcf550bed275187d872c6e6ee7599bc (patch)
tree4d986b7d56e1de19a3e646696439151a8996cce8 /com32/lib
parent89478bdbfa7167bc1b627a478d042c99e46f06b7 (diff)
downloadsyslinux-e93773c42fcf550bed275187d872c6e6ee7599bc.tar.gz
syslinux-e93773c42fcf550bed275187d872c6e6ee7599bc.tar.xz
syslinux-e93773c42fcf550bed275187d872c6e6ee7599bc.zip
Fix expansion of palette images to ABGR.
We would expand palette images to BGR, but not to ABGR. Fix.
Diffstat (limited to 'com32/lib')
-rw-r--r--com32/lib/sys/vesa/background.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c
index 29c22750..2103a9c1 100644
--- a/com32/lib/sys/vesa/background.c
+++ b/com32/lib/sys/vesa/background.c
@@ -122,23 +122,16 @@ static int read_png_file(FILE *fp)
/* Set the appropriate set of transformations. We need to end up
with 32-bit BGRA format, no more, no less. */
+ /* Expand to RGB first... */
+
switch (info_ptr->color_type) {
+ case PNG_COLOR_TYPE_GRAY:
case PNG_COLOR_TYPE_GRAY_ALPHA:
png_set_gray_to_rgb(png_ptr);
- /* fall through */
-
- case PNG_COLOR_TYPE_RGB_ALPHA:
break;
- case PNG_COLOR_TYPE_GRAY:
- png_set_gray_to_rgb(png_ptr);
- /* fall through */
-
case PNG_COLOR_TYPE_RGB:
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
- png_set_tRNS_to_alpha(png_ptr);
- else
- png_set_add_alpha(png_ptr, ~0, PNG_FILLER_AFTER);
+ case PNG_COLOR_TYPE_RGB_ALPHA:
break;
case PNG_COLOR_TYPE_PALETTE:
@@ -150,6 +143,20 @@ static int read_png_file(FILE *fp)
break;
}
+ /* ... then add an alpha channel ... */
+ switch (info_ptr->color_type) {
+ case PNG_COLOR_TYPE_GRAY_ALPHA:
+ case PNG_COLOR_TYPE_RGB_ALPHA:
+ break;
+
+ default:
+ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha(png_ptr);
+ else
+ png_set_add_alpha(png_ptr, ~0, PNG_FILLER_AFTER);
+ break;
+ }
+
png_set_bgr(png_ptr);
if (info_ptr->bit_depth == 16)