#include <pthread.h>
#include <sys/types.h>
#include <unistd.h>
+#include <byteswap.h>
+
+#ifndef BYTE_ORDER
+#error "no BYTE_ORDER defined!"
+#endif
// use this for init Freetype...
#include <ft2build.h>
static FTC_Font cache_current_font=0;
#endif
-#define RBG565
-
struct fntColorCacheKey
{
gRGB start, end;
for (int i=0; i<16; ++i)
{
#define BLEND(y, x, a) (y + (((x-y) * a)>>8))
-
- unsigned char dr = background.r, dg = background.g, db = background.b;
+ unsigned char da = background.a, dr = background.r, dg = background.g, db = background.b;
int sa = i * 16;
if (sa < 256)
{
db = BLEND(background.b, foreground.b, sa) & 0xFF;
}
#undef BLEND
-#ifdef RBG565
- lookup16_normal[i] = ((dr >> 3) << 11) | ((db >> 2) << 5) | (dg >> 3);
+#if BYTE_ORDER == LITTLE_ENDIAN
+ lookup16_normal[i] = bswap_16(((db >> 3) << 11) | ((dg >> 2) << 5) | (dr >> 3));
#else
- lookup16_normal[i] = ((dr >> 3) << 11) | ((dg >> 2) << 5) | (db >> 3);
+ lookup16_normal[i] = ((db >> 3) << 11) | ((dg >> 2) << 5) | (dr >> 3);
#endif
+ da ^= 0xFF;
}
for (int i=0; i<16; ++i)
lookup16_invert[i]=lookup16_normal[i^0xF];