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 <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann committed 2012-05-30 18:48:59 +02:00
1 parent 7129a9038c
commit d17342982b
1 file changed
+14
+14
View File
@@ -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