change casts to c++ style

Signed-off-by: Sophia Hadash <sophiahadash@gmail.com>
This commit is contained in:
shadash 2021-10-02 21:34:38 +02:00 committed by Sophia Hadash
parent f37d915653
commit 9d23d124d4

View file

@ -95,7 +95,8 @@ void FlexboxComponent::computeLayout()
// Pre-compute layout parameters.
int n = mChildren.size();
int nLines = std::max(1, (int)std::ceil(n / std::max(1, (int)mItemsPerLine)));
int nLines =
std::max(1, static_cast<int>(std::ceil(n / std::max(1, static_cast<int>(mItemsPerLine)))));
float lineWidth =
(mDirection == "row" ? (maxItemSize.y + mItemMargin.y) : (maxItemSize.x + mItemMargin.x));
float anchorXStart = anchorX;
@ -144,7 +145,7 @@ void FlexboxComponent::computeLayout()
child->setPosition(getPosition().x + x, getPosition().y + y);
// Translate anchor.
if ((i + 1) % std::max(1, (int)mItemsPerLine) != 0) {
if ((i + 1) % std::max(1, static_cast<int>(mItemsPerLine)) != 0) {
// Translate on same line.
anchorX += (size.x + mItemMargin.x) * directionLine.x;
anchorY += (size.y + mItemMargin.y) * directionLine.y;