X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/f2b1a7e86c4143b6112a119bd00a2adcc0844b71..b9c0b3c8ec8c7979848126d9c88764043d685d26:/lib/gdi/font.cpp diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 0d2e958f..74cda40e 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -6,6 +6,11 @@ #include #include #include +#include + +#ifndef BYTE_ORDER +#error "no BYTE_ORDER defined!" +#endif // use this for init Freetype... #include @@ -41,8 +46,6 @@ static pthread_mutex_t ftlock=PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; static FTC_Font cache_current_font=0; #endif -#define RBG565 - struct fntColorCacheKey { gRGB start, end; @@ -790,8 +793,7 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons 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) { @@ -800,11 +802,12 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons 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];