[mutter/wip/carlosg/pango-alpha: 1/2] cogl-pango: Honor foreground alpha PangoAttribute



commit 03fc20cdb4d9b042020a5d1de97f9fc41512adf7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Mar 27 23:05:03 2020 +0100

    cogl-pango: Honor foreground alpha PangoAttribute
    
    Instead of hardcoding 0xff as alpha, forward this attribute.

 cogl/cogl-pango/cogl-pango-render.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-pango/cogl-pango-render.c b/cogl/cogl-pango/cogl-pango-render.c
index 7a19f2d8f..306513db7 100644
--- a/cogl/cogl-pango/cogl-pango-render.c
+++ b/cogl/cogl-pango/cogl-pango-render.c
@@ -719,6 +719,7 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer   *renderer,
                                         PangoRenderPart  part)
 {
   PangoColor *pango_color = pango_renderer_get_color (renderer, part);
+  uint16_t alpha = pango_renderer_get_alpha (renderer, part);
   CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
 
   if (pango_color)
@@ -729,7 +730,7 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer   *renderer,
                                 pango_color->red >> 8,
                                 pango_color->green >> 8,
                                 pango_color->blue >> 8,
-                                0xff);
+                                alpha >> 8);
 
       _cogl_pango_display_list_set_color_override (priv->display_list, &color);
     }
@@ -908,8 +909,11 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer    *renderer,
               if (cache_value->has_color)
                 {
                   CoglColor color;
+                  uint16_t alpha;
 
-                  cogl_color_init_from_4ub (&color, 0xff, 0xff, 0xff, 0xff);
+                  alpha = pango_renderer_get_alpha (renderer,
+                                                    PANGO_RENDER_PART_FOREGROUND);
+                  cogl_color_init_from_4ub (&color, 0xff, 0xff, 0xff, alpha >> 8);
                   _cogl_pango_display_list_set_color_override (priv->display_list, &color);
                 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]