Fix const declaration mismatch and double/float mix

Summary:
This PR fixes a declaration mismatch for `YGNodeCanUseCachedMeasurement` where the last argument is declared non `const` in `.h` and `const` in `.c`.

Additionally it uses explicit `float` for fraction calculation do avoid usage of `double` assignment.
Closes https://github.com/facebook/yoga/pull/607

Differential Revision: D5677931

Pulled By: emilsjolander

fbshipit-source-id: 502da957089e4439ed956987ff8dec10bd033ba3
This commit is contained in:
Lukas Wöhrl 2017-08-23 02:40:04 -07:00 committed by Facebook Github Bot
parent 9c2caaac3e
commit 95faccb13c
2 changed files with 3 additions and 3 deletions

View File

@ -3171,12 +3171,12 @@ float YGRoundValueToPixelGrid(const float value,
scaledValue = scaledValue - fractial + 1.0; scaledValue = scaledValue - fractial + 1.0;
} 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.0; scaledValue = scaledValue - fractial + 1.0f;
} else if (forceFloor) { } else if (forceFloor) {
scaledValue = scaledValue - fractial; scaledValue = scaledValue - fractial;
} else { } else {
// Finally we just round the value // Finally we just round the value
scaledValue = scaledValue - fractial + (fractial >= 0.5f ? 1.0 : 0); scaledValue = scaledValue - fractial + (fractial >= 0.5f ? 1.0f : 0.0f);
} }
return scaledValue / pointScaleFactor; return scaledValue / pointScaleFactor;
} }

View File

@ -112,7 +112,7 @@ WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
const float lastComputedHeight, const float lastComputedHeight,
const float marginRow, const float marginRow,
const float marginColumn, const float marginColumn,
YGConfigRef config); const YGConfigRef config);
WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode); WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode);