From 60b44cc5be188986e4e017bed354bf8e369ff264 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 26 Jul 2009 23:25:59 +0000 Subject: [PATCH] Show how we could optimise dirty rectangle handling in a box fill. Disabled for now because it does not work with fullwidth characters. --- caca/box.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/caca/box.c b/caca/box.c index 7324e73..4405c3f 100644 --- a/caca/box.c +++ b/caca/box.c @@ -1,6 +1,6 @@ /* * libcaca Colour ASCII-Art library - * Copyright (c) 2002-2006 Sam Hocevar + * Copyright (c) 2002-2009 Sam Hocevar * All Rights Reserved * * $Id$ @@ -139,10 +139,24 @@ int caca_fill_box(caca_canvas_t *cv, int x, int y, int w, int h, if(x2 > xmax) x2 = xmax; if(y2 > ymax) y2 = ymax; +#if 0 + /* FIXME: this fails with fullwidth character blits. Also, the dirty + * rectangle handling may miss fullwidth cells. */ + /* Optimise dirty rectangle handling, part 1 */ + cv->dirty_disabled++; +#endif + for(j = y; j <= y2; j++) for(i = x; i <= x2; i++) caca_put_char(cv, i, j, ch); +#if 0 + /* Optimise dirty rectangle handling, part 2 */ + cv->dirty_disabled--; + if(!cv->dirty_disabled) + caca_add_dirty_rect(cv, x, y, x2 - x + 1, y2 - y + 1); +#endif + return 0; }