backwards iterators

pull/1/head
cosmonaut 2022-07-21 17:37:13 -07:00
parent 651bdf7685
commit 6b6c8625a0
1 changed files with 2 additions and 10 deletions

View File

@ -298,7 +298,7 @@ void Cram_Internal_PruneRects(RectPackContext* context)
for (i = 0; i < context->freeRectangleCount; i += 1)
{
for (j = 0; j < context->newFreeRectangleCount;)
for (j = context->newFreeRectangleCount - 1; j >= 0; j -= 1)
{
if (Cram_Internal_Contains(&context->freeRectangles[i], &context->newFreeRectangles[j]))
{
@ -306,10 +306,6 @@ void Cram_Internal_PruneRects(RectPackContext* context)
context->newFreeRectangles[j] = context->newFreeRectangles[context->newFreeRectangleCount - 1];
context->newFreeRectangleCount -= 1;
}
else
{
j += 1;
}
}
}
@ -418,7 +414,7 @@ void Cram_Internal_PlaceRect(RectPackContext *context, Rect *rect)
Rect *freeRect;
int32_t i;
for (i = 0; i < context->freeRectangleCount;)
for (i = context->freeRectangleCount - 1; i >= 0; i -= 1)
{
freeRect = &context->freeRectangles[i];
@ -428,10 +424,6 @@ void Cram_Internal_PlaceRect(RectPackContext *context, Rect *rect)
context->freeRectangles[i] = context->freeRectangles[context->freeRectangleCount - 1];
context->freeRectangleCount -= 1;
}
else
{
i += 1;
}
}
Cram_Internal_PruneRects(context);