Fix alpha handling resulting in no images with 24-bit bmp

This commit is contained in:
K. Lange 2018-05-04 13:16:22 +09:00
parent 9adae25874
commit 5cf95b4fc0
2 changed files with 2 additions and 1 deletions

View File

@ -86,6 +86,7 @@ int main (int argc, char * argv[]) {
while (optind < argc) {
sprite_t * image = calloc(sizeof(sprite_t),1);
load_sprite(image, argv[optind]);
image->alpha = ALPHA_EMBEDDED;
sprite_t * source = image;

View File

@ -401,7 +401,7 @@ void load_sprite(sprite_t * sprite, char * filename) {
if (bpp == 24) {
color = (bufferb[i + 3 * x] & 0xFF) +
(bufferb[i+1 + 3 * x] & 0xFF) * 0x100 +
(bufferb[i+2 + 3 * x] & 0xFF) * 0x10000;
(bufferb[i+2 + 3 * x] & 0xFF) * 0x10000 + 0xFF000000;
} else if (bpp == 32) {
if (bufferb[i + 4 * x] == 0) {
color = 0x000000;