X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=render%2Ffont.c;h=cde0d0309bf92a01f6d3c45255df8a427f03360d;hb=fa0ae17adbc8f73b707c33836d37841e81b9303a;hp=5ccfb8fd2850f6267025b58f57c0a2ec69a5f0ec;hpb=3167fc223ea82851ae954b348a5ff1c0ce6b6d79;p=chaz%2Fopenbox diff --git a/render/font.c b/render/font.c index 5ccfb8fd..cde0d030 100644 --- a/render/font.c +++ b/render/font.c @@ -217,7 +217,7 @@ static inline int font_calculate_baseline(RrFont *f, gint height) void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) { - gint x,y,w,h; + gint x,y,w; XftColor c; gint mw; PangoRectangle rect; @@ -240,7 +240,7 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) w = area->width; if (t->flow) w = MAX(w, t->maxwidth); w -= 4; - h = area->height; + /* h = area->height; */ if (t->flow) ell = PANGO_ELLIPSIZE_NONE; @@ -258,6 +258,8 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) case RR_ELLIPSIZE_END: ell = PANGO_ELLIPSIZE_END; break; + default: + g_assert_not_reached(); } } @@ -285,9 +287,20 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) } if (t->shadow_offset_x || t->shadow_offset_y) { - c.color.red = t->shadow_color->r | t->shadow_color->r << 8; - c.color.green = t->shadow_color->g | t->shadow_color->g << 8; - c.color.blue = t->shadow_color->b | t->shadow_color->b << 8; + /* From nvidia's readme (chapter 23): + + When rendering to a 32-bit window, keep in mind that the X RENDER + extension, used by most composite managers, expects "premultiplied + alpha" colors. This means that if your color has components (r,g,b) + and alpha value a, then you must render (a*r, a*g, a*b, a) into the + target window. + */ + c.color.red = (t->shadow_color->r | t->shadow_color->r << 8) * + t->shadow_alpha / 255; + c.color.green = (t->shadow_color->g | t->shadow_color->g << 8) * + t->shadow_alpha / 255; + c.color.blue = (t->shadow_color->b | t->shadow_color->b << 8) * + t->shadow_alpha / 255; c.color.alpha = 0xffff * t->shadow_alpha / 255; c.pixel = t->shadow_color->pixel;