Compare commits

..

1 Commits

Author SHA1 Message Date
Harrison Lambeth
5f7d793235
Merge df79cc9e53 into 1bcf256e4d 2025-01-28 22:06:27 -07:00
8 changed files with 10 additions and 22 deletions

View File

@ -117,7 +117,6 @@ TextElementConfig :: struct {
letterSpacing: u16,
lineHeight: u16,
wrapMode: TextWrapMode,
hashStringContents: bool,
}
ImageElementConfig :: struct {

Binary file not shown.

Binary file not shown.

Binary file not shown.

13
clay.h
View File

@ -324,7 +324,6 @@ typedef struct {
uint16_t letterSpacing;
uint16_t lineHeight;
Clay_TextElementConfigWrapMode wrapMode;
bool hashStringContents;
#ifdef CLAY_EXTEND_CONFIG_TEXT
CLAY_EXTEND_CONFIG_TEXT
#endif
@ -988,18 +987,9 @@ uint32_t Clay__HashTextWithConfig(Clay_String *text, Clay_TextElementConfig *con
uint32_t hash = 0;
uintptr_t pointerAsNumber = (uintptr_t)text->chars;
if (config->hashStringContents) {
uint32_t maxLengthToHash = CLAY__MIN(text->length, 256);
for (int i = 0; i < maxLengthToHash; i++) {
hash += text->chars[i];
hash += (hash << 10);
hash ^= (hash >> 6);
}
} else {
hash += pointerAsNumber;
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += text->length;
hash += (hash << 10);
@ -1199,7 +1189,6 @@ Clay_LayoutElementHashMapItem* Clay__AddHashMapItem(Clay_ElementId elementId, Cl
if (hashItem->elementId.id == elementId.id) { // Collision - resolve based on generation
item.nextIndex = hashItem->nextIndex;
if (hashItem->generation <= context->generation) { // First collision - assume this is the "same" element
hashItem->elementId = elementId; // Make sure to copy this across. If the stringId reference has changed, we should update the hash item to use the new one.
hashItem->generation = context->generation + 1;
hashItem->layoutElement = layoutElement;
hashItem->debugData->collision = false;
@ -3077,7 +3066,7 @@ uint32_t Clay_MinMemorySize(void) {
Clay__Context_Allocate_Arena(&fakeContext.internalArena);
Clay__InitializePersistentMemory(&fakeContext);
Clay__InitializeEphemeralMemory(&fakeContext);
return fakeContext.internalArena.nextAllocation + 128;
return fakeContext.internalArena.nextAllocation;
}
CLAY_WASM_EXPORT("Clay_CreateArenaWithCapacityAndMemory")