From ee3018643d87ab79d599ccd68007188a6a225d9e Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Mon, 18 May 2009 13:02:43 +0000 Subject: [PATCH] Only redraw empty rectangles in slang driver --- caca/driver/slang.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/caca/driver/slang.c b/caca/driver/slang.c index 875ea7e..525eca5 100644 --- a/caca/driver/slang.c +++ b/caca/driver/slang.c @@ -222,14 +222,17 @@ static void slang_display(caca_display_t *dp) { uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv); uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); - int width = caca_get_canvas_width(dp->cv); - int height = caca_get_canvas_height(dp->cv); int x, y; + int xmin, ymin, xmax, ymax; - for(y = 0; y < (int)height; y++) + caca_get_dirty_rectangle(dp->cv, &xmin, &ymin, &xmax, &ymax); + if(xmin > xmax || ymin > ymax) + return; + + for(y = ymin; y <= ymax; y++) { SLsmg_gotorc(y, 0); - for(x = width; x--; ) + for(x = xmax; x >= xmin; x--) { uint32_t ch = *cvchars++;