mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-29 15:48:05 +00:00
Compare commits
4 Commits
f8accf55b5
...
f2a69e74d2
Author | SHA1 | Date | |
---|---|---|---|
|
f2a69e74d2 | ||
|
6cb9c7c483 | ||
|
723f59dffd | ||
|
79cf2419e0 |
9
clay.h
9
clay.h
@ -21,6 +21,14 @@
|
||||
#ifndef CLAY_HEADER
|
||||
#define CLAY_HEADER
|
||||
|
||||
#if !( \
|
||||
(defined(__cplusplus) && __cplusplus >= 202002L) || \
|
||||
(defined(__STDC__) && __STDC__ == 1 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||
defined(_MSC_VER) \
|
||||
)
|
||||
#error "Clay requires C99, C++20, or MSVC"
|
||||
#endif
|
||||
|
||||
#ifdef CLAY_WASM
|
||||
#define CLAY_WASM_EXPORT(name) __attribute__((export_name(name)))
|
||||
#else
|
||||
@ -2392,6 +2400,7 @@ void Clay__CalculateFinalLayout(void) {
|
||||
Clay__WrappedTextLineArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay__WrappedTextLine) { { measuredWord->width, lineHeight }, { .length = measuredWord->length, .chars = &textElementData->text.chars[measuredWord->startOffset] } });
|
||||
textElementData->wrappedLines.length++;
|
||||
wordIndex = measuredWord->next;
|
||||
lineStartOffset = measuredWord->startOffset + measuredWord->length;
|
||||
}
|
||||
// measuredWord->length == 0 means a newline character
|
||||
else if (measuredWord->length == 0 || lineWidth + measuredWord->width > containerElement->dimensions.width) {
|
||||
|
@ -426,7 +426,8 @@
|
||||
element.style.height = Math.round(renderCommand.boundingBox.height.value) + 'px';
|
||||
}
|
||||
|
||||
switch(renderCommand.commandType.value) {
|
||||
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding
|
||||
switch(renderCommand.commandType.value & 0xff) {
|
||||
case (CLAY_RENDER_COMMAND_TYPE_NONE): {
|
||||
break;
|
||||
}
|
||||
@ -580,7 +581,9 @@
|
||||
for (let i = 0; i < length; i++, arrayOffset += renderCommandSize) {
|
||||
let renderCommand = readStructAtAddress(arrayOffset, renderCommandDefinition);
|
||||
let boundingBox = renderCommand.boundingBox;
|
||||
switch(renderCommand.commandType.value) {
|
||||
|
||||
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding
|
||||
switch(renderCommand.commandType.value & 0xff) {
|
||||
case (CLAY_RENDER_COMMAND_TYPE_NONE): {
|
||||
break;
|
||||
}
|
||||
|
@ -317,7 +317,9 @@
|
||||
for (let i = 0; i < length; i++, arrayOffset += renderCommandSize) {
|
||||
let renderCommand = readStructAtAddress(arrayOffset, renderCommandDefinition);
|
||||
let boundingBox = renderCommand.boundingBox;
|
||||
switch(renderCommand.commandType.value) {
|
||||
|
||||
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding
|
||||
switch(renderCommand.commandType.value & 0xff) {
|
||||
case (CLAY_RENDER_COMMAND_TYPE_NONE): {
|
||||
break;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@
|
||||
let element = null;
|
||||
if (!elementCache[renderCommand.id.value]) {
|
||||
let elementType = 'div';
|
||||
switch (renderCommand.commandType.value) {
|
||||
switch (renderCommand.commandType.value & 0xff) {
|
||||
case CLAY_RENDER_COMMAND_TYPE_RECTANGLE: {
|
||||
if (readStructAtAddress(renderCommand.config.value, rectangleConfigDefinition).link.length.value > 0) {
|
||||
elementType = 'a';
|
||||
@ -384,7 +384,8 @@
|
||||
element.style.height = Math.round(renderCommand.boundingBox.height.value) + 'px';
|
||||
}
|
||||
|
||||
switch(renderCommand.commandType.value) {
|
||||
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding
|
||||
switch(renderCommand.commandType.value & 0xff) {
|
||||
case (CLAY_RENDER_COMMAND_TYPE_NONE): {
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user