From d17342982bfa2c31d371cc9590d0ff8a55bbfaa2 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 30 May 2012 18:48:59 +0200 Subject: [PATCH] font: draw backgrounds The pango backend now correctly draws colored or uncolored backgrounds. This is needed to support drawing cursors. We currently do not optimize this for performance. In fact, this reduces performance a lot and we could avoid drawing backgrounds if we cleared the background to the same color before. However, this also means we currently could move drawing the background into the console backend again. The transparency feature is awful, anyway and I don't see any reason supporting it. Signed-off-by: David Herrmann --- src/font_pango.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/font_pango.c b/src/font_pango.c index 3a7616b..aebda27 100644 --- a/src/font_pango.c +++ b/src/font_pango.c @@ -689,6 +689,7 @@ int font_screen_draw_start(struct font_screen *screen) cairo_set_operator(screen->cr, CAIRO_OPERATOR_OVER); cairo_set_source_rgb(screen->cr, 1, 1, 1); + cairo_set_line_width(screen->cr, 1.0); if (screen->absolute) cairo_scale(screen->cr, screen->scale_x, screen->scale_y); @@ -717,6 +718,19 @@ int font_screen_draw_char(struct font_screen *screen, kmscon_symbol_t ch, return ret; } + if (attr->inverse) + cairo_set_source_rgb(screen->cr, attr->fr, attr->fg, attr->fb); + else + cairo_set_source_rgb(screen->cr, attr->br, attr->bg, attr->bb); + + cairo_move_to(screen->cr, cellx * screen->advance_x, + celly * screen->advance_y); + cairo_rel_line_to(screen->cr, screen->advance_x, 0); + cairo_rel_line_to(screen->cr, 0, screen->advance_y); + cairo_rel_line_to(screen->cr, -screen->advance_x, 0); + cairo_close_path(screen->cr); + cairo_fill(screen->cr); + if (attr->inverse) cairo_set_source_rgb(screen->cr, attr->br, attr->bg, attr->bb); else