cogl-pango: Make color glyphs unaffected by foreground color

Making color glyphs affected by the foreground color makes them become
"tinted" on any other color than white. Make it sure we always paint
those white by checking the cached glyph value, the foreground color
will be reset on the next iteration through glyphs.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/850

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1148
This commit is contained in:
Carlos Garnacho 2020-03-25 00:29:19 +01:00 committed by Carlos Garnacho
parent 40fb06ca17
commit 3aece84499

View File

@ -841,14 +841,13 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
CoglPangoGlyphCacheValue *cache_value; CoglPangoGlyphCacheValue *cache_value;
int i; int i;
cogl_pango_renderer_set_color_for_part (renderer,
PANGO_RENDER_PART_FOREGROUND);
for (i = 0; i < glyphs->num_glyphs; i++) for (i = 0; i < glyphs->num_glyphs; i++)
{ {
PangoGlyphInfo *gi = glyphs->glyphs + i; PangoGlyphInfo *gi = glyphs->glyphs + i;
float x, y; float x, y;
cogl_pango_renderer_set_color_for_part (renderer,
PANGO_RENDER_PART_FOREGROUND);
cogl_pango_renderer_get_device_units (renderer, cogl_pango_renderer_get_device_units (renderer,
xi + gi->geometry.x_offset, xi + gi->geometry.x_offset,
yi + gi->geometry.y_offset, yi + gi->geometry.y_offset,
@ -905,6 +904,15 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
x += (float)(cache_value->draw_x); x += (float)(cache_value->draw_x);
y += (float)(cache_value->draw_y); y += (float)(cache_value->draw_y);
/* Do not override color if the glyph/font provide its own */
if (cache_value->has_color)
{
CoglColor color;
cogl_color_init_from_4ub (&color, 0xff, 0xff, 0xff, 0xff);
_cogl_pango_display_list_set_color_override (priv->display_list, &color);
}
cogl_pango_renderer_draw_glyph (priv, cache_value, x, y); cogl_pango_renderer_draw_glyph (priv, cache_value, x, y);
} }
} }