summaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-02-26 12:13:59 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2011-02-26 12:13:59 +0100
commit0b8356aa927db1d536c00211a7d77fd2168d70dc (patch)
treea377947d3d0e110ba82e94990b8f92d07b022f4a /font.c
parentd1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13 (diff)
downloadvdr-0b8356aa927db1d536c00211a7d77fd2168d70dc.tar.gz
vdr-0b8356aa927db1d536c00211a7d77fd2168d70dc.tar.bz2
Improved and cleaned up transparent text drawing
Diffstat (limited to 'font.c')
-rw-r--r--font.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/font.c b/font.c
index 227dd63f..db1bd893 100644
--- a/font.c
+++ b/font.c
@@ -6,7 +6,7 @@
*
* BiDi support by Osama Alrawab <alrawab@hotmail.com> @2008 Tripoli-Libya.
*
- * $Id: font.c 2.6 2011/02/20 14:15:38 kls Exp $
+ * $Id: font.c 2.7 2011/02/26 12:09:18 kls Exp $
*/
#include "font.h"
@@ -338,7 +338,6 @@ void cFreetypeFont::DrawText(cPixmap *Pixmap, int x, int y, const char *s, tColo
s = bs;
#endif
bool AntiAliased = Setup.AntiAlias;
- bool TransparentBackground = ColorBg == clrTransparent;
uint prevSym = 0;
while (*s) {
int sl = Utf8CharLen(s);
@@ -358,16 +357,8 @@ void cFreetypeFont::DrawText(cPixmap *Pixmap, int x, int y, const char *s, tColo
for (int pitch = 0; pitch < g->Pitch(); pitch++) {
uchar bt = *(buffer + (row * g->Pitch() + pitch));
if (AntiAliased) {
- if (bt > 0x00) {
- tColor bg;
- if (bt == 0xFF || TransparentBackground)
- bg = ColorFg;
- else {
- bg = AlphaBlend(ColorFg, ColorBg, bt);
- bt = ALPHA_OPAQUE;
- }
- Pixmap->DrawPixel(cPoint(x + pitch + g->Left() + kerning, y + row + (height - Bottom() - g->Top())), bg, bt);
- }
+ if (bt > 0x00)
+ Pixmap->DrawPixel(cPoint(x + pitch + g->Left() + kerning, y + row + (height - Bottom() - g->Top())), AlphaBlend(ColorFg, ColorBg, bt));
}
else { //monochrome rendering
for (int col = 0; col < 8 && col + pitch * 8 <= symWidth; col++) {