From 55d4e27ca19d44bd8bd349ed6126782339b8b25b Mon Sep 17 00:00:00 2001 From: martin-s Date: Thu, 19 Nov 2009 20:20:14 +0000 Subject: [PATCH] Fix:graphics_gtk_drawing_area:Fixed drawing of colored fonts git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2763 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- .../gtk_drawing_area/graphics_gtk_drawing_area.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c index fac0817..6c707eb 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -340,13 +340,15 @@ display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, str if (g->w && g->h) { if (color) { stride=g->w; - glyph=g_malloc(stride*g->h); - gr->freetype_methods.get_glyph(g, glyph, 8, stride, &fg->c, &bg->c, &transparent); - gdk_draw_gray_image(gr->drawable, bg->gc, (x+g->x)>>6, (y+g->y)>>6, g->w, g->h, GDK_RGB_DITHER_NONE, glyph, g->w); - g_free(glyph); + if (bg) { + glyph=g_malloc(stride*g->h); + gr->freetype_methods.get_glyph(g, glyph, 8, stride, &fg->c, &bg->c, &transparent); + gdk_draw_gray_image(gr->drawable, bg->gc, (x+g->x)>>6, (y+g->y)>>6, g->w, g->h, GDK_RGB_DITHER_NONE, glyph, g->w); + g_free(glyph); + } stride*=3; glyph=g_malloc(stride*g->h); - gr->freetype_methods.get_glyph(g, glyph, 24, stride, &fg->c, &bg->c, &transparent); + gr->freetype_methods.get_glyph(g, glyph, 24, stride, &fg->c, bg?&bg->c:&transparent, &transparent); gdk_draw_rgb_image(gr->drawable, fg->gc, (x+g->x)>>6, (y+g->y)>>6, g->w, g->h, GDK_RGB_DITHER_NONE, glyph, stride); g_free(glyph); } else @@ -391,14 +393,17 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics color=1; } else { gdk_gc_set_function(fg->gc, GDK_OR); +#if 0 gdk_gc_set_function(bg->gc, GDK_AND_INVERT); +#endif color=1; } t=gr->freetype_methods.text_new(text, (struct font_freetype_font *)font, dx, dy); display_text_draw(t, gr, fg, bg, color, p); gr->freetype_methods.text_destroy(t); gdk_gc_set_function(fg->gc, GDK_COPY); - gdk_gc_set_function(bg->gc, GDK_COPY); + if (bg) + gdk_gc_set_function(bg->gc, GDK_COPY); #if 0 { struct point pnt[5]; -- 1.7.9.5