Some selection optimizations

- Add bounds, so that we don't process any locations outside
  as those locations are known to be unset
- The bounds are only recalculated if needed
- Replace instances of selection_not where we actually want
  a new selection with all locations set
This commit is contained in:
Pasi Kallinen
2022-08-26 12:31:25 +03:00
parent e815498f07
commit 5e9ed7a290
5 changed files with 203 additions and 31 deletions

View File

@@ -128,6 +128,16 @@ intersect(NhRect* r1, NhRect* r2, NhRect* r3)
return TRUE;
}
/* Put the rectangle containing both r1 and r2 into r3 */
void
rect_bounds(NhRect r1, NhRect r2, NhRect *r3)
{
r3->lx = min(r1.lx, r2.lx);
r3->ly = min(r1.ly, r2.ly);
r3->hx = max(r1.hx, r2.hx);
r3->hy = max(r1.hy, r2.hy);
}
/*
* Remove a rectangle from the list of free NhRect.
*/