mirror of
https://github.com/nicbarker/clay.git
synced 2025-01-23 18:06:04 +00:00
Fix text measurement default bucket count
This commit is contained in:
parent
b8725bfb65
commit
41f6616993
8
clay.h
8
clay.h
@ -491,7 +491,7 @@ extern bool Clay__debugMaxElementsLatch;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CLAY__TEXT_MEASURE_HASH_BUCKET_COUNT
|
#ifndef CLAY__TEXT_MEASURE_HASH_BUCKET_COUNT
|
||||||
#define CLAY__TEXT_MEASURE_HASH_BUCKET_COUNT (CLAY_MAX_ELEMENT_COUNT / 2)
|
#define CLAY__TEXT_MEASURE_HASH_BUCKET_COUNT 128
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CLAY_MEASURE_TEXT_CACHE_SIZE
|
#ifndef CLAY_MEASURE_TEXT_CACHE_SIZE
|
||||||
@ -1557,10 +1557,10 @@ Clay__MeasuredWord *Clay__AddMeasuredWord(Clay__MeasuredWord word, Clay__Measure
|
|||||||
uint32_t newItemIndex = Clay__int32_tArray_Get(&Clay__measuredWordsFreeList, (int)Clay__measuredWordsFreeList.length - 1);
|
uint32_t newItemIndex = Clay__int32_tArray_Get(&Clay__measuredWordsFreeList, (int)Clay__measuredWordsFreeList.length - 1);
|
||||||
Clay__measuredWordsFreeList.length--;
|
Clay__measuredWordsFreeList.length--;
|
||||||
Clay__MeasuredWordArray_Set(&Clay__measuredWords, (int)newItemIndex, word);
|
Clay__MeasuredWordArray_Set(&Clay__measuredWords, (int)newItemIndex, word);
|
||||||
previousWord->next = newItemIndex;
|
previousWord->next = (int32_t)newItemIndex;
|
||||||
return Clay__MeasuredWordArray_Get(&Clay__measuredWords, (int)newItemIndex);
|
return Clay__MeasuredWordArray_Get(&Clay__measuredWords, (int)newItemIndex);
|
||||||
} else {
|
} else {
|
||||||
previousWord->next = Clay__measuredWords.length;
|
previousWord->next = (int32_t)Clay__measuredWords.length;
|
||||||
return Clay__MeasuredWordArray_Add(&Clay__measuredWords, word);
|
return Clay__MeasuredWordArray_Add(&Clay__measuredWords, word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1994,7 +1994,7 @@ void Clay__InitializePersistentMemory(Clay_Arena *arena) {
|
|||||||
Clay__layoutElementsHashMap = Clay__int32_tArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
Clay__layoutElementsHashMap = Clay__int32_tArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
||||||
Clay__measureTextHashMapInternal = Clay__MeasureTextCacheItemArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
Clay__measureTextHashMapInternal = Clay__MeasureTextCacheItemArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
||||||
Clay__measureTextHashMapInternalFreeList = Clay__int32_tArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
Clay__measureTextHashMapInternalFreeList = Clay__int32_tArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
||||||
Clay__measuredWordsFreeList = Clay__int32_tArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
Clay__measuredWordsFreeList = Clay__int32_tArray_Allocate_Arena(CLAY_MEASURE_TEXT_CACHE_SIZE, arena);
|
||||||
Clay__measureTextHashMap = Clay__int32_tArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
Clay__measureTextHashMap = Clay__int32_tArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
||||||
Clay__measuredWords = Clay__MeasuredWordArray_Allocate_Arena(CLAY_MEASURE_TEXT_CACHE_SIZE, arena);
|
Clay__measuredWords = Clay__MeasuredWordArray_Allocate_Arena(CLAY_MEASURE_TEXT_CACHE_SIZE, arena);
|
||||||
Clay__pointerOverIds = Clay__ElementIdArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
Clay__pointerOverIds = Clay__ElementIdArray_Allocate_Arena(CLAY_MAX_ELEMENT_COUNT, arena);
|
||||||
|
Loading…
Reference in New Issue
Block a user