Console: Fix cell-selection when drawing glyphs
authorDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 1 Dec 2011 17:33:49 +0000 (18:33 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 1 Dec 2011 17:33:49 +0000 (18:33 +0100)
We didn't calculate the correct cell number when drawing a cell. Fix that.

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/console.c

index d3f4c31..bd9514b 100644 (file)
@@ -226,7 +226,7 @@ err_free:
  */
 void kmscon_console_draw(struct kmscon_console *con)
 {
-       size_t i, j;
+       size_t i, j, pos;
        double xs, ys, x, y;
 
        if (!con || !con->cr)
@@ -248,7 +248,8 @@ void kmscon_console_draw(struct kmscon_console *con)
        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,
+                       pos = i * con->lines_x + j;
+                       kmscon_font_draw(con->font, con->cells[pos].ch, con->cr,
                                                                        x, y);
                        x += xs;
                }