Fix float type mismatch on endOfLineIndex and inside rounding
Summary: This PR fixes a type mismatch on `endOfLineIndex` where it should be of type `uint32_t` while it is of type `float` Additonally it fixes some `double` casting in the rounding methods. Closes https://github.com/facebook/yoga/pull/745 Differential Revision: D7494519 Pulled By: emilsjolander fbshipit-source-id: 30a86574ce163458a6888f61a902d0640c1874fb
This commit is contained in:
committed by
Facebook Github Bot
parent
4b760fa9bc
commit
cb6e76973d
@@ -40,7 +40,7 @@ struct YGCollectFlexItemsRowValues {
|
|||||||
float sizeConsumedOnCurrentLine;
|
float sizeConsumedOnCurrentLine;
|
||||||
float totalFlexGrowFactors;
|
float totalFlexGrowFactors;
|
||||||
float totalFlexShrinkScaledFactors;
|
float totalFlexShrinkScaledFactors;
|
||||||
float endOfLineIndex;
|
uint32_t endOfLineIndex;
|
||||||
std::vector<YGNodeRef> relativeChildren;
|
std::vector<YGNodeRef> relativeChildren;
|
||||||
float remainingFreeSpace;
|
float remainingFreeSpace;
|
||||||
// The size of the mainDim for the row after considering size, padding, margin
|
// The size of the mainDim for the row after considering size, padding, margin
|
||||||
|
@@ -3368,12 +3368,12 @@ float YGRoundValueToPixelGrid(const float value,
|
|||||||
const bool forceCeil,
|
const bool forceCeil,
|
||||||
const bool forceFloor) {
|
const bool forceFloor) {
|
||||||
float scaledValue = value * pointScaleFactor;
|
float scaledValue = value * pointScaleFactor;
|
||||||
float fractial = fmodf(scaledValue, 1.0);
|
float fractial = fmodf(scaledValue, 1.0f);
|
||||||
if (YGFloatsEqual(fractial, 0)) {
|
if (YGFloatsEqual(fractial, 0)) {
|
||||||
// First we check if the value is already rounded
|
// First we check if the value is already rounded
|
||||||
scaledValue = scaledValue - fractial;
|
scaledValue = scaledValue - fractial;
|
||||||
} else if (YGFloatsEqual(fractial, 1.0)) {
|
} else if (YGFloatsEqual(fractial, 1.0f)) {
|
||||||
scaledValue = scaledValue - fractial + 1.0;
|
scaledValue = scaledValue - fractial + 1.0f;
|
||||||
} else if (forceCeil) {
|
} else if (forceCeil) {
|
||||||
// Next we check if we need to use forced rounding
|
// Next we check if we need to use forced rounding
|
||||||
scaledValue = scaledValue - fractial + 1.0f;
|
scaledValue = scaledValue - fractial + 1.0f;
|
||||||
|
Reference in New Issue
Block a user