aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi/font.cpp
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2010-06-01 18:59:04 +0200
committerghost <andreas.monzner@multimedia-labs.de>2010-06-01 18:59:04 +0200
commitcc7b41fb073611a631648d002750690051f5f886 (patch)
tree026728eec4f94afdfa67394200719cefac42cbbe /lib/gdi/font.cpp
parentc8724d0d7b016371309f189636b0992ea413bd96 (diff)
downloadenigma2-cc7b41fb073611a631648d002750690051f5f886.tar.gz
enigma2-cc7b41fb073611a631648d002750690051f5f886.zip
fix color oled support
Diffstat (limited to 'lib/gdi/font.cpp')
-rw-r--r--lib/gdi/font.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp
index f7699b9c..6688a3d4 100644
--- a/lib/gdi/font.cpp
+++ b/lib/gdi/font.cpp
@@ -6,6 +6,11 @@
#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>
@@ -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;
@@ -772,8 +775,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)
{
@@ -782,11 +784,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];