Compare commits

..

5 Commits

Author SHA1 Message Date
Joram Vandemoortele
7da283045d
Merge af3d63ad0f into b33ba4ff62 2025-04-16 23:19:03 +02:00
Nic Barker
b33ba4ff62
[Core] Fix a string hash bug with single characters (#384)
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
2025-04-16 20:16:05 +12:00
Jackson Novak
f88f0517f7
[Documentation] Fix Clay_String definition in README.md file. (#374) 2025-04-16 20:07:16 +12:00
Tim Lügger
5391a259f3
[Renderers/Raylib] Fix raylib renderer border bottom left corner radius (#378)
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
2025-04-14 14:26:12 +12:00
Lily Nikitin
fe2d44a888
[Renderers/Raylib] Add explicit type cast for malloc (#379) 2025-04-14 14:23:13 +12:00
4 changed files with 15 additions and 5 deletions

View File

@ -1796,7 +1796,8 @@ Note: when using the debug tools, their internal colors are represented as 0-255
```C ```C
typedef struct { typedef struct {
int length; bool isStaticallyAllocated;
int32_t length;
const char *chars; const char *chars;
} Clay_String; } Clay_String;
``` ```
@ -1805,7 +1806,14 @@ typedef struct {
**Fields** **Fields**
**`.length`** - `int` **`.isStaticallyAllocated`** - `bool`
Whether or not the string is statically allocated, or in other words, whether
or not it lives for the entire lifetime of the program.
---
**`.length`** - `int32_t`
The number of characters in the string, _not including an optional null terminator._ The number of characters in the string, _not including an optional null terminator._

2
clay.h
View File

@ -1395,6 +1395,7 @@ uint64_t Clay__HashData(const uint8_t* data, size_t length) {
Clay__SIMDARXMix(&v2, &v3); Clay__SIMDARXMix(&v2, &v3);
v0 = _mm_add_epi64(v0, v2); v0 = _mm_add_epi64(v0, v2);
v1 = _mm_add_epi64(v1, v3); v1 = _mm_add_epi64(v1, v3);
v0 = _mm_add_epi64(v0, v1);
uint64_t result[2]; uint64_t result[2];
_mm_storeu_si128((__m128i*)result, v0); _mm_storeu_si128((__m128i*)result, v0);
@ -1448,6 +1449,7 @@ uint64_t Clay__HashData(const uint8_t* data, size_t length) {
Clay__SIMDARXMix(&v2, &v3); Clay__SIMDARXMix(&v2, &v3);
v0 = vaddq_u64(v0, v2); v0 = vaddq_u64(v0, v2);
v1 = vaddq_u64(v1, v3); v1 = vaddq_u64(v1, v3);
v0 = vaddq_u64(v0, v1);
uint64_t result[2]; uint64_t result[2];
vst1q_u64(result, v0); vst1q_u64(result, v0);

View File

@ -22,7 +22,7 @@ FetchContent_MakeAvailable(fontstash)
FetchContent_Declare( FetchContent_Declare(
sokol sokol
GIT_REPOSITORY "https://github.com/floooh/sokol.git" GIT_REPOSITORY "https://github.com/floooh/sokol.git"
GIT_TAG "da9de496f938b7575eff7f01ab774d77469bd390" GIT_TAG "master"
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
GIT_SHALLOW TRUE GIT_SHALLOW TRUE
) )

View File

@ -157,7 +157,7 @@ void Clay_Raylib_Render(Clay_RenderCommandArray renderCommands, Font* fonts)
if(strlen > temp_render_buffer_len) { if(strlen > temp_render_buffer_len) {
// Grow the temp buffer if we need a larger string // Grow the temp buffer if we need a larger string
if(temp_render_buffer) free(temp_render_buffer); if(temp_render_buffer) free(temp_render_buffer);
temp_render_buffer = malloc(strlen); temp_render_buffer = (char *) malloc(strlen);
temp_render_buffer_len = strlen; temp_render_buffer_len = strlen;
} }
@ -225,7 +225,7 @@ void Clay_Raylib_Render(Clay_RenderCommandArray renderCommands, Font* fonts)
DrawRing((Vector2) { roundf(boundingBox.x + boundingBox.width - config->cornerRadius.topRight), roundf(boundingBox.y + config->cornerRadius.topRight) }, roundf(config->cornerRadius.topRight - config->width.top), config->cornerRadius.topRight, 270, 360, 10, CLAY_COLOR_TO_RAYLIB_COLOR(config->color)); DrawRing((Vector2) { roundf(boundingBox.x + boundingBox.width - config->cornerRadius.topRight), roundf(boundingBox.y + config->cornerRadius.topRight) }, roundf(config->cornerRadius.topRight - config->width.top), config->cornerRadius.topRight, 270, 360, 10, CLAY_COLOR_TO_RAYLIB_COLOR(config->color));
} }
if (config->cornerRadius.bottomLeft > 0) { if (config->cornerRadius.bottomLeft > 0) {
DrawRing((Vector2) { roundf(boundingBox.x + config->cornerRadius.bottomLeft), roundf(boundingBox.y + boundingBox.height - config->cornerRadius.bottomLeft) }, roundf(config->cornerRadius.bottomLeft - config->width.top), config->cornerRadius.bottomLeft, 90, 180, 10, CLAY_COLOR_TO_RAYLIB_COLOR(config->color)); DrawRing((Vector2) { roundf(boundingBox.x + config->cornerRadius.bottomLeft), roundf(boundingBox.y + boundingBox.height - config->cornerRadius.bottomLeft) }, roundf(config->cornerRadius.bottomLeft - config->width.bottom), config->cornerRadius.bottomLeft, 90, 180, 10, CLAY_COLOR_TO_RAYLIB_COLOR(config->color));
} }
if (config->cornerRadius.bottomRight > 0) { if (config->cornerRadius.bottomRight > 0) {
DrawRing((Vector2) { roundf(boundingBox.x + boundingBox.width - config->cornerRadius.bottomRight), roundf(boundingBox.y + boundingBox.height - config->cornerRadius.bottomRight) }, roundf(config->cornerRadius.bottomRight - config->width.bottom), config->cornerRadius.bottomRight, 0.1, 90, 10, CLAY_COLOR_TO_RAYLIB_COLOR(config->color)); DrawRing((Vector2) { roundf(boundingBox.x + boundingBox.width - config->cornerRadius.bottomRight), roundf(boundingBox.y + boundingBox.height - config->cornerRadius.bottomRight) }, roundf(config->cornerRadius.bottomRight - config->width.bottom), config->cornerRadius.bottomRight, 0.1, 90, 10, CLAY_COLOR_TO_RAYLIB_COLOR(config->color));