@@ -1950,6 +1950,15 @@ void Clay__SizeContainersAlongAxis(bool xAxis) {
19501950 }
19511951}
19521952
1953+ static inline Clay_BoundingBox Clay__BoundingBoxWithRoundedValues (float x , float y , float width , float height ) {
1954+ return CLAY__INIT (Clay_BoundingBox ) {
1955+ (int32_t )(x + (x > 0 ? 0.5f : -0.5f )),
1956+ (int32_t )(y + (y > 0 ? 0.5f : -0.5f )),
1957+ (int32_t )(width + (width > 0 ? 0.5f : -0.5f )),
1958+ (int32_t )(height + (height > 0 ? 0.5f : -0.5f ))
1959+ };
1960+ }
1961+
19531962void Clay__CalculateFinalLayout () {
19541963 // Calculate sizing along the X axis
19551964 Clay__SizeContainersAlongAxis (true);
@@ -2198,7 +2207,7 @@ void Clay__CalculateFinalLayout() {
21982207 if (!Clay__treeNodeVisited .internalArray [dfsBuffer .length - 1 ]) {
21992208 Clay__treeNodeVisited .internalArray [dfsBuffer .length - 1 ] = true;
22002209
2201- Clay_BoundingBox currentElementBoundingBox = CLAY__INIT ( Clay_BoundingBox ) { currentElementTreeNode -> position .x , currentElementTreeNode -> position .y , currentElement -> dimensions .width , currentElement -> dimensions .height } ;
2210+ Clay_BoundingBox currentElementBoundingBox = Clay__BoundingBoxWithRoundedValues ( currentElementTreeNode -> position .x , currentElementTreeNode -> position .y , currentElement -> dimensions .width , currentElement -> dimensions .height ) ;
22022211 if (currentElement -> elementType == CLAY__LAYOUT_ELEMENT_TYPE_FLOATING_CONTAINER ) {
22032212 Clay_FloatingElementConfig * floatingElementConfig = currentElement -> elementConfig .floatingElementConfig ;
22042213 Clay_Dimensions expand = floatingElementConfig -> expand ;
@@ -2330,7 +2339,7 @@ void Clay__CalculateFinalLayout() {
23302339 });
23312340 // Borders between elements are expressed as additional rectangle render commands
23322341 } else if (currentElement -> elementType == CLAY__LAYOUT_ELEMENT_TYPE_BORDER_CONTAINER ) {
2333- Clay_BoundingBox currentElementBoundingBox = CLAY__INIT ( Clay_BoundingBox ) { currentElementTreeNode -> position .x , currentElementTreeNode -> position .y , currentElement -> dimensions .width , currentElement -> dimensions .height } ;
2342+ Clay_BoundingBox currentElementBoundingBox = Clay__BoundingBoxWithRoundedValues ( currentElementTreeNode -> position .x , currentElementTreeNode -> position .y , currentElement -> dimensions .width , currentElement -> dimensions .height ) ;
23342343 #ifndef CLAY_DISABLE_CULLING
23352344 bool offscreen = currentElementBoundingBox .x > (float )Clay__layoutDimensions .width || currentElementBoundingBox .y > (float )Clay__layoutDimensions .height || currentElementBoundingBox .x + currentElementBoundingBox .width < 0 || currentElementBoundingBox .y + currentElementBoundingBox .height < 0 ;
23362345 if (offscreen ) {
0 commit comments