From: David Herrmann Date: Thu, 27 Sep 2012 10:26:30 +0000 (+0200) Subject: tsm: screen: fix cleaning buffers on resize X-Git-Tag: kmscon-7~468 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c328b2300ca0a83ffc36c43d95131a88008e1b3;p=platform%2Fupstream%2Fkmscon.git tsm: screen: fix cleaning buffers on resize There is some nasty bug where we do not correctly clean buffers when resizing. So we now clear the whole offscreen region on resize to go sure everything is clean. Note that cells can pretty much move everywhere during their offscreen-life so this is a quite sophisticated task to keep track which cells are clean and which not. Therefore, simply clean all of them when taking them on-screen. Signed-off-by: David Herrmann --- diff --git a/src/tsm_screen.c b/src/tsm_screen.c index 3f4b920..fc96576 100644 --- a/src/tsm_screen.c +++ b/src/tsm_screen.c @@ -552,9 +552,20 @@ int tsm_screen_resize(struct tsm_screen *con, unsigned int x, } /* When resizing, we need to reset all the new cells, otherwise, the old - * data that was written there will reoccur on the screen. */ - for (j = 0; j < y; ++j) { - for (i = con->size_x; i < x; ++i) + * data that was written there will reoccur on the screen. + * TODO: we overwrite way to much here; most of it should already be + * cleaned. Maybe it does more sense cleaning when _allocating_ or when + * _shrinking_, then we never clean twice (for performance reasons). */ + for (j = 0; j < con->line_num; ++j) { + if (j >= con->size_y) + i = 0; + else + i = con->size_x; + if (x < con->lines[j]->size) + width = x; + else + width = con->lines[j]->size; + for (; i < width; ++i) cell_init(con, &con->lines[j]->cells[i]); }