[AD] Fwd: OSX - bug in fixbundle |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
---------- Forwarded message ----------
From: Peter Hull <peterhull90@xxxxxxxxxx>
Date: Sep 27, 2006 10:24 PM
Subject: OSX - bug in fixbundle
To: alleg-developers@xxxxxxxxxx
I've committed a change to fixbundle because its 32-bit icon
generation was not endian-independent. Under Intel macs the colours
would be wrong.
I tested it on Intel 10.4 and PPC 10.2, if anyone has any other
combination and would like to test it, please let me know the results.
Pete
Index: tools/macosx/fixbundle.c
===================================================================
--- tools/macosx/fixbundle.c (revision 7534)
+++ tools/macosx/fixbundle.c (working copy)
@@ -360,11 +360,6 @@
set_color_depth(32);
set_color_conversion(COLORCONV_TOTAL | COLORCONV_KEEP_TRANS);
- _rgb_a_shift_32 = 24;
- _rgb_r_shift_32 = 16;
- _rgb_g_shift_32 = 8;
- _rgb_b_shift_32 = 0;
-
if (argc < 2)
usage();
@@ -504,7 +499,16 @@
for (i = 0; i < 4; i++) {
if (flags & icon_data[i].defined) {
/* Set 32bit RGBA data */
- PtrToHand(icon_data[i].scaled->line[0], &raw_data,
icon_data[i].size * icon_data[i].size * 4);
+ raw_data = NewHandle(icon_data[i].size * icon_data[i].size * 4);
+ data = *(unsigned char **)raw_data;
+ for (y = 0; y < icon_data[i].size; y++) {
+ for (x = 0; x < icon_data[i].size; x++) {
+ *data++ = geta32(((unsigned int
*)(icon_data[i].scaled->line[y]))[x]);
+ *data++ = getr32(((unsigned int
*)(icon_data[i].scaled->line[y]))[x]);
+ *data++ = getg32(((unsigned int
*)(icon_data[i].scaled->line[y]))[x]);
+ *data++ = getb32(((unsigned int
*)(icon_data[i].scaled->line[y]))[x]);
+ }
+ }
if (SetIconFamilyData(icon_family, icon_data[i].data,
raw_data) != noErr) {
DisposeHandle(raw_data);
fprintf(stderr, "Error setting %dx%d icon resource RGBA
data\n", icon_data[i].size, icon_data[i].size);