Optimization for the duplicate paintop

Cyrille Berger cberger at cberger.net
Tue May 30 14:21:54 CEST 2006


> We use extactRect in many places, though, and optimizing it would be a
> great idea.
Ok while teasing Bart on irc, I had two genious strike (yes it can happen) to 
optimize the function, one I am sure would increase the speed, for the one it 
will need testing,
- so first idea : in the first part we compute 'boundY' and 'boundH', we 
should use them in the second part instead of 'y' and 'h' (it should bring a 
small spead improvement) note that using nextRow/Col, prevRow/Col could bring 
some speed improvement too
- second idea : I will write pseudo code for only one of the check, I will let 
you imagine for the other one:
minbound = y;
maxbound = y+h;
while(not found)
{
i = (maxbound + minboud) / 2;

if( checkline( i ))
{
	maxbound = i;
} else {
	minbound = i;
}
if(maxboud == minbound) found = true;
}

Note: nextRow/Col, prevRow/Col are incompatible with my the second idea, would 
be interesting to know which one is faster, would need some test.

What do you think ?

-- 
--- Cyrille Berger ---


More information about the kimageshop mailing list