[renderer] Use VRect_SubRect for scrap allocation

While the results are a little surprising (tends to alternate between
left side and top for allocations), there is much less wasted space in
the partially allocated regions, and the main free region seems to
always be quite big.
This commit is contained in:
Bill Currie 2022-09-02 19:08:58 +09:00
parent 28e9a0a9ba
commit db69f5fd23

View file

@ -90,8 +90,8 @@ R_ScrapAlloc (rscrap_t *scrap, int width, int height)
return 0; // couldn't find a spot
old = *best;
*best = old->next;
rect = VRect_New (old->x, old->y, width, height);
frags = VRect_Difference (old, rect);
rect = VRect_SubRect (old, width, height);
frags = rect->next;
VRect_Delete (old);
if (frags) {
// old was bigger than the requested size