From: David Herrmann Date: Sat, 26 Nov 2011 15:54:40 +0000 (+0100) Subject: Draw console X-Git-Tag: kmscon-7~1358 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7149b5dd3734e6076d503cca6538ed837cab6f7a;p=platform%2Fupstream%2Fkmscon.git Draw console Properly draw all cells of a console on redraw. Signed-off-by: David Herrmann --- diff --git a/src/console.c b/src/console.c index 6bc6f79..e42dba1 100644 --- a/src/console.c +++ b/src/console.c @@ -201,6 +201,9 @@ err_free: */ void kmscon_console_draw(struct kmscon_console *con) { + size_t i, j; + double xs, ys, x, y; + if (!con || !con->cr) return; @@ -210,7 +213,22 @@ void kmscon_console_draw(struct kmscon_console *con) cairo_set_source_rgba(con->cr, 0.0, 0.0, 0.0, 0.0); cairo_paint(con->cr); - // TODO: draw console here + cairo_set_operator(con->cr, CAIRO_OPERATOR_OVER); + cairo_set_source_rgba(con->cr, 1.0, 1.0, 1.0, 1.0); + + xs = con->res_x / (double)con->lines_x; + ys = con->res_y / (double)con->lines_y; + + y = 0; + for (i = 0; i < con->lines_y; ++i) { + x = 0; + for (j = 0; j < con->lines_x; ++j) { + kmscon_font_draw(con->font, con->cells[i].ch, con->cr, + x, y); + x += xs; + } + y += ys; + } cairo_restore(con->cr);