X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fgdi%2Ffont.cpp;h=a5db43a9e3af99765f12ae4e91d933c5d38c1899;hb=7ff071c7f0df631ca273d7f29472f8b5568818f9;hp=0d2e958f226975df93733347f2764eaf2001260f;hpb=f2b1a7e86c4143b6112a119bd00a2adcc0844b71;p=vuplus_dvbapp diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 0d2e958..a5db43a 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; @@ -367,7 +370,7 @@ int eTextPara::appendGlyph(Font *current_font, FT_Face current_face, FT_UInt gly } pGlyph ng; - ng.bbox.setLeft( (flags&GS_ISFIRST|cursor.x()-1)+glyph->left ); + ng.bbox.setLeft( ((flags&GS_ISFIRST)|(cursor.x()-1))+glyph->left ); ng.bbox.setTop( cursor.y() - glyph->top ); ng.bbox.setWidth( glyph->width ); ng.bbox.setHeight( glyph->height ); @@ -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];