mirror of
https://github.com/nicbarker/clay.git
synced 2025-05-07 02:48:04 +00:00
Compare commits
4 Commits
7e8dcd6e7b
...
61b1f04a26
Author | SHA1 | Date | |
---|---|---|---|
|
61b1f04a26 | ||
|
208c7cb3a0 | ||
|
63a74a92a8 | ||
|
8d3cadc52e |
7
clay.h
7
clay.h
@ -2804,7 +2804,8 @@ void Clay__CalculateFinalLayout() {
|
|||||||
Clay__AddRenderCommand(renderCommand);
|
Clay__AddRenderCommand(renderCommand);
|
||||||
if (borderConfig->betweenChildren.width > 0 && borderConfig->betweenChildren.color.a > 0) {
|
if (borderConfig->betweenChildren.width > 0 && borderConfig->betweenChildren.color.a > 0) {
|
||||||
Clay_RectangleElementConfig *rectangleConfig = Clay__StoreRectangleElementConfig(CLAY__INIT(Clay_RectangleElementConfig) {.color = borderConfig->betweenChildren.color});
|
Clay_RectangleElementConfig *rectangleConfig = Clay__StoreRectangleElementConfig(CLAY__INIT(Clay_RectangleElementConfig) {.color = borderConfig->betweenChildren.color});
|
||||||
Clay_Vector2 borderOffset = { (float)layoutConfig->padding.x, (float)layoutConfig->padding.y };
|
float halfGap = layoutConfig->childGap / 2;
|
||||||
|
Clay_Vector2 borderOffset = { (float)layoutConfig->padding.x - halfGap, (float)layoutConfig->padding.y - halfGap };
|
||||||
if (layoutConfig->layoutDirection == CLAY_LEFT_TO_RIGHT) {
|
if (layoutConfig->layoutDirection == CLAY_LEFT_TO_RIGHT) {
|
||||||
for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) {
|
for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) {
|
||||||
Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, currentElement->childrenOrTextContent.children.elements[i]);
|
Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, currentElement->childrenOrTextContent.children.elements[i]);
|
||||||
@ -2816,7 +2817,7 @@ void Clay__CalculateFinalLayout() {
|
|||||||
.commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
|
.commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
borderOffset.x += (childElement->dimensions.width + (float)layoutConfig->childGap / 2);
|
borderOffset.x += (childElement->dimensions.width + (float)layoutConfig->childGap);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) {
|
for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) {
|
||||||
@ -2829,7 +2830,7 @@ void Clay__CalculateFinalLayout() {
|
|||||||
.commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
|
.commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
borderOffset.y += (childElement->dimensions.height + (float)layoutConfig->childGap / 2);
|
borderOffset.y += (childElement->dimensions.height + (float)layoutConfig->childGap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
fuzz/fuzzing_target.c
Normal file
24
fuzz/fuzzing_target.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "clay.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||||
|
if (size < sizeof(Clay_String)) return 0;
|
||||||
|
|
||||||
|
Clay_String testString = { .length = size, .chars = (const char *)data };
|
||||||
|
|
||||||
|
Clay_Dimensions dimensions = MeasureText(&testString, NULL);
|
||||||
|
|
||||||
|
// Call other critical functions
|
||||||
|
Clay_Arena arena = Clay_CreateArenaWithCapacityAndMemory(1024, (void*)data);
|
||||||
|
Clay_Initialize(arena, (Clay_Dimensions){1024, 768});
|
||||||
|
Clay_SetPointerState((Clay_Vector2){0, 0}, false);
|
||||||
|
Clay_BeginLayout();
|
||||||
|
Clay_EndLayout();
|
||||||
|
|
||||||
|
// Handle pointer state changes
|
||||||
|
Clay_SetPointerState((Clay_Vector2){1, 1}, true);
|
||||||
|
Clay_SetPointerState((Clay_Vector2){2, 2}, false);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user