[mutter/wip/carlosg/pango-renderer-color-glyphs: 2/2] cogl-pango: Make color glyphs unaffected by foreground color
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/pango-renderer-color-glyphs: 2/2] cogl-pango: Make color glyphs unaffected by foreground color
- Date: Tue, 24 Mar 2020 23:53:29 +0000 (UTC)
commit 49df668639e2d79b0823ec3f44de11282846d0c3
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Mar 25 00:29:19 2020 +0100
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
cogl/cogl-pango/cogl-pango-render.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/cogl/cogl-pango/cogl-pango-render.c b/cogl/cogl-pango/cogl-pango-render.c
index d1ef39cb0..7a19f2d8f 100644
--- a/cogl/cogl-pango/cogl-pango-render.c
+++ b/cogl/cogl-pango/cogl-pango-render.c
@@ -841,14 +841,13 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
CoglPangoGlyphCacheValue *cache_value;
int i;
- cogl_pango_renderer_set_color_for_part (renderer,
- PANGO_RENDER_PART_FOREGROUND);
-
for (i = 0; i < glyphs->num_glyphs; i++)
{
PangoGlyphInfo *gi = glyphs->glyphs + i;
float x, y;
+ cogl_pango_renderer_set_color_for_part (renderer,
+ PANGO_RENDER_PART_FOREGROUND);
cogl_pango_renderer_get_device_units (renderer,
xi + gi->geometry.x_offset,
yi + gi->geometry.y_offset,
@@ -905,6 +904,15 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
x += (float)(cache_value->draw_x);
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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]