From 8e368671cc1d8be2f6307f2a387d5976b3da8577 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 12 Mar 2006 14:53:18 +0000 Subject: [PATCH] Fix inadvertent O(N^2) loop within do_paint() which I just discovered when profiling IPBT. [originally from svn r6602] --- terminal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/terminal.c b/terminal.c index db61a1ac..72ff9f90 100644 --- a/terminal.c +++ b/terminal.c @@ -4822,10 +4822,12 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise) != newline[j].attr) { int k; - for (k = laststart; k < j; k++) - term->disptext[i]->chars[k].attr |= ATTR_INVALID; + if (!dirtyrect) { + for (k = laststart; k < j; k++) + term->disptext[i]->chars[k].attr |= ATTR_INVALID; - dirtyrect = TRUE; + dirtyrect = TRUE; + } } if (dirtyrect)