Optimise white hot find_sides to take advantage of sorted float_children.

Now we have an early exit when we get to the floats above the area we're
interested in.
This commit is contained in:
Michael Drake 2016-01-20 18:42:30 +00:00
parent 948a93041d
commit c13080d96c

View File

@ -2062,8 +2062,14 @@ void find_sides(struct box *fl, int y0, int y1,
*left = *right = 0; *left = *right = 0;
for (; fl; fl = fl->next_float) { for (; fl; fl = fl->next_float) {
fy0 = fl->y;
fy1 = fl->y + fl->height; fy1 = fl->y + fl->height;
if (fy1 < y0) {
/* Floats are sorted in order of decreasing bottom pos.
* Past here, all floats will be too high to concern us.
*/
return;
}
fy0 = fl->y;
if (y0 < fy1 && fy0 <= y1) { if (y0 < fy1 && fy0 <= y1) {
if (fl->type == BOX_FLOAT_LEFT) { if (fl->type == BOX_FLOAT_LEFT) {
fx1 = fl->x + fl->width; fx1 = fl->x + fl->width;