From: <tj...@us...> - 2006-10-29 04:27:40
|
Revision: 7556 http://svn.sourceforge.net/alleg/?rev=7556&view=rev Author: tjaden Date: 2006-10-28 21:27:27 -0700 (Sat, 28 Oct 2006) Log Message: ----------- Made 32-bit icon generation endian-independent (colours were incorrect on Intel macs) [merge 4.2 to 4.3] Modified Paths: -------------- allegro/branches/4.3/tools/macosx/fixbundle.c Modified: allegro/branches/4.3/tools/macosx/fixbundle.c =================================================================== --- allegro/branches/4.3/tools/macosx/fixbundle.c 2006-10-29 04:25:07 UTC (rev 7555) +++ allegro/branches/4.3/tools/macosx/fixbundle.c 2006-10-29 04:27:27 UTC (rev 7556) @@ -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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |