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