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

4
clay.h
View file

@ -3076,11 +3076,15 @@ 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_LayoutElementHashMapItem *currentElementData = Clay__GetHashMapItem(currentElement->id);
Clay_BoundingBox currentElementBoundingBox = currentElementData->boundingBox;
if (!Clay__ElementIsOffscreen(&currentElementBoundingBox)) {
Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand) { Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand) {
.id = Clay__HashNumber(currentElement->id, rootElement->childrenOrTextContent.children.length + 11).id, .id = Clay__HashNumber(currentElement->id, rootElement->childrenOrTextContent.children.length + 11).id,
.commandType = CLAY_RENDER_COMMAND_TYPE_SCISSOR_END, .commandType = CLAY_RENDER_COMMAND_TYPE_SCISSOR_END,
}); });
} }
}
dfsBuffer.length--; dfsBuffer.length--;
continue; continue;