[mutter/wip/carlosg/actor-opacity-on-text] cogl-pango: Factor in default color alpha again



commit e8ea5ecd8ae1edb1a714dc970f198a9b2a64b565
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Mar 28 12:27:38 2020 +0100

    cogl-pango: Factor in default color alpha again
    
    In commit d846fabda we moved to using the override color alpha, however
    it was missed that the actor opacity is transferred to the PangoRenderer
    through the default color alpha, and the reason it was used there.
    
    We actually want to factor in both alpha values, in order to respect
    both foreground color alpha and actor opacity. This is done on the
    unpremultiplied color, so we just need to change the alpha value.
    
    Fixes effects on text actors that involve actor opacity.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1158

 cogl/cogl-pango/cogl-pango-display-list.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/cogl/cogl-pango/cogl-pango-display-list.c b/cogl/cogl-pango/cogl-pango-display-list.c
index 0483f46e3..caf202d06 100644
--- a/cogl/cogl-pango/cogl-pango-display-list.c
+++ b/cogl/cogl-pango/cogl-pango-display-list.c
@@ -421,7 +421,9 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
                                   cogl_color_get_red_byte (&node->color),
                                   cogl_color_get_green_byte (&node->color),
                                   cogl_color_get_blue_byte (&node->color),
-                                  cogl_color_get_alpha_byte (&node->color));
+                                  (cogl_color_get_alpha_byte (&node->color) *
+                                   cogl_color_get_alpha_byte (color) /
+                                   255));
       else
         draw_color = *color;
       cogl_color_premultiply (&draw_color);


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