summaryrefslogtreecommitdiff
path: root/pango/pangocairo-render.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-08-11 15:39:22 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-08-11 20:39:14 -0400
commit9f44c20b3ca62f0de2cc9adc64c14109174c3a8a (patch)
tree07e79ebe46c7cb85f3c4557f13a8bb8debef513e /pango/pangocairo-render.c
parent884db27321c7eb381fbec23fa445cc481bf546b7 (diff)
downloadpango-9f44c20b3ca62f0de2cc9adc64c14109174c3a8a.tar.gz
Add alpha support to PangoCairoRenderer
Make PangoCairoRenderer use cairo_set_source_rgba() to apply colors with alpha. Note that this means we are only using the alpha if the corresponding color has been set.
Diffstat (limited to 'pango/pangocairo-render.c')
-rw-r--r--pango/pangocairo-render.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 3855fc26..b1efb37f 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -191,12 +191,17 @@ set_color (PangoCairoRenderer *crenderer,
PangoRenderPart part)
{
PangoColor *color = pango_renderer_get_color ((PangoRenderer *) (crenderer), part);
+ guint16 alpha = pango_renderer_get_alpha ((PangoRenderer *) (crenderer), part);
+
+ if (!alpha)
+ alpha = 0xffff;
if (color)
- cairo_set_source_rgb (crenderer->cr,
- color->red / 65535.,
- color->green / 65535.,
- color->blue / 65535.);
+ cairo_set_source_rgba (crenderer->cr,
+ color->red / 65535.,
+ color->green / 65535.,
+ color->blue / 65535.,
+ alpha / 65535.);
}
/* note: modifies crenderer->cr without doing cairo_save/restore() */