[mojosetup] Support for BMPV5 headers
Sam Izzo
sam at horsedrawngames.com
Thu May 19 00:17:02 EDT 2016
Hi,
I added support for BMPV5 headers. Attached is a patch. I pulled the
change from the latest stb_image, which already supports it. BMPV5 adds
ICC colour profiles; stb_image just ignores it.
My ImageMagick was generating BMPV5 format, and I had no idea why the
image wasn't showing up in the installer (I also have changes to add
some more debug logging if you want to merge that in too).
I considered merging in the latest stb_image but it's quite a bit newer,
and there were a lot of changes. It was going to be more work than I
wanted to do right now :)
Cheers,
Sam
-------------- next part --------------
# HG changeset patch
# User Sam Izzo <sam at humbug.net>
# Date 1463631005 -36000
# Thu May 19 14:10:05 2016 +1000
# Node ID 7473ad8918d5eb5fdde727027f15ea5b3e3300a9
# Parent 0e351d80da0467cc7b11a5a8c5ce5aa3f0aca153
Pulled in support for V5 BMP headers from the latest stb_image.
diff -r 0e351d80da04 -r 7473ad8918d5 stb_image.c
--- a/stb_image.c Fri Jan 01 19:53:21 2016 +0100
+++ b/stb_image.c Thu May 19 14:10:05 2016 +1000
@@ -2661,7 +2661,7 @@
get16le(); // discard reserved
get32le(); // discard data offset
sz = get32le();
- if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1;
+ if (sz == 12 || sz == 40 || sz == 56 || sz == 108 || sz == 124) return 1;
return 0;
}
@@ -2744,7 +2744,7 @@
get16le(); // discard reserved
offset = get32le();
hsz = get32le();
- if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc("unknown BMP", "BMP type not supported: unknown");
+ if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return epuc("unknown BMP", "BMP type not supported: unknown");
failure_reason = "bad BMP";
if (hsz == 12) {
img_x = get16le();
@@ -2801,7 +2801,8 @@
return NULL;
}
} else {
- assert(hsz == 108);
+ if (hsz != 108 && hsz != 124)
+ return epuc("bad BMP", "bad BMP");
mr = get32le();
mg = get32le();
mb = get32le();
@@ -2809,6 +2810,12 @@
get32le(); // discard color space
for (i=0; i < 12; ++i)
get32le(); // discard color space parameters
+ if (hsz == 124) {
+ get32le(); // discard rendering intent
+ get32le(); // discard offset of profile data
+ get32le(); // discard size of profile data
+ get32le(); // discard reserved
+ }
}
if (bpp < 16)
psize = (offset - 14 - hsz) >> 2;
More information about the mojosetup
mailing list