I don't know if the loader has endianness issues

(I guess it does), but this should definitely
work better.


SVN revision: 2848
This commit is contained in:
Christian Kreibich 2000-06-21 16:36:40 +00:00
parent af590f9221
commit e9746c22f2
1 changed files with 23 additions and 21 deletions

View File

@ -45,6 +45,8 @@
#include <netinet/in.h>
#include "image.h"
#include "Imlib2.h"
#include "colormod.h"
#include "blend.h"
/* #define XCF_DBG */
@ -778,18 +780,18 @@ read_tiles_into_data(Tile* tiles, int num_rows, int num_cols,
/* use colormap if the image has one */
if (image->cmap)
{
*ptr++ = image->cmap[*(ptr2) * 3];
*ptr++ = image->cmap[*(ptr2) * 3 + 1];
*ptr++ = image->cmap[*(ptr2) * 3 + 2];
*ptr++ = 255;
R_VAL(ptr) = image->cmap[*(ptr2) * 3];
G_VAL(ptr) = image->cmap[*(ptr2) * 3 + 1];
B_VAL(ptr) = image->cmap[*(ptr2) * 3 + 2];
A_VAL(ptr) = 255;
}
/* else use colors themselves */
else
{
*ptr++ = *(ptr2);
*ptr++ = *(ptr2);
*ptr++ = *(ptr2);
*ptr++ = 255;
R_VAL(ptr) = *(ptr2);
G_VAL(ptr) = *(ptr2);
B_VAL(ptr) = *(ptr2);
A_VAL(ptr) = 255;
}
break;
}
@ -798,10 +800,10 @@ read_tiles_into_data(Tile* tiles, int num_rows, int num_cols,
/* use colormap if the image has one */
if (image->cmap)
{
*ptr++ = image->cmap[*(ptr2) * 3];
*ptr++ = image->cmap[*(ptr2) * 3 + 1];
*ptr++ = image->cmap[*(ptr2) * 3 + 2];
*ptr++ = *(ptr2+1);
R_VAL(ptr) = image->cmap[*(ptr2) * 3];
G_VAL(ptr) = image->cmap[*(ptr2) * 3 + 1];
B_VAL(ptr) = image->cmap[*(ptr2) * 3 + 2];
A_VAL(ptr) = *(ptr2+1);
}
/* else use colors themselves */
else
@ -818,23 +820,23 @@ read_tiles_into_data(Tile* tiles, int num_rows, int num_cols,
}
else
{
*ptr++ = *(ptr2+2);
*ptr++ = *(ptr2+1);
*ptr++ = *(ptr2+0);
*ptr++ = 255;
R_VAL(ptr) = *(ptr2);
G_VAL(ptr) = *(ptr2+1);
B_VAL(ptr) = *(ptr2+2);
A_VAL(ptr) = 255;
}
break;
}
default:
{
/* BGRA, not RGBA ? */
*ptr++ = *(ptr2+2);
*ptr++ = *(ptr2+1);
*ptr++ = *(ptr2+0);
*ptr++ = *(ptr2+3);
R_VAL(ptr) = *(ptr2);
G_VAL(ptr) = *(ptr2+1);
B_VAL(ptr) = *(ptr2+2);
A_VAL(ptr) = *(ptr2+3);
break;
}
}
ptr += 4;
}
}
}