Prevent unbalanced SCISSOR_END commands for culled containers

This commit is contained in:
Davide Depau 2025-12-25 22:04:09 +01:00
parent 7d099ad870
commit 02abf00b01

12
clay.h
View file

@ -3076,10 +3076,14 @@ void Clay__CalculateFinalLayout(void) {
} }
// This exists because the scissor needs to end _after_ borders between elements // This exists because the scissor needs to end _after_ borders between elements
if (closeClipElement) { if (closeClipElement) {
Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand) { Clay_LayoutElementHashMapItem *currentElementData = Clay__GetHashMapItem(currentElement->id);
.id = Clay__HashNumber(currentElement->id, rootElement->childrenOrTextContent.children.length + 11).id, Clay_BoundingBox currentElementBoundingBox = currentElementData->boundingBox;
.commandType = CLAY_RENDER_COMMAND_TYPE_SCISSOR_END, if (!Clay__ElementIsOffscreen(&currentElementBoundingBox)) {
}); Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand) {
.id = Clay__HashNumber(currentElement->id, rootElement->childrenOrTextContent.children.length + 11).id,
.commandType = CLAY_RENDER_COMMAND_TYPE_SCISSOR_END,
});
}
} }
dfsBuffer.length--; dfsBuffer.length--;